vbscript read binary data from sql server

Jak
Jak
Member
858 Points
132 Posts

Hi,

How read binary data from sql server in vbscript ?

Views: 9004
Total Answered: 1
Total Marked As Answer: 1
Posted On: 09-Mar-2015 12:20

Share:   fb twitter linkedin
Answers
NiceOne Team
NiceOne...
Editor
1382 Points
14 Posts
         

Hi, Rahul

You can use <IMG> tag to display images stored in the database by calling another ASP page in SRC attribute of <IMG> tag.

For example:

<IMG SRC="ShowPicture.asp?PhotoId=1">

where PhotoId is the ID stored in the database.

ShowPicture.asp:

 

<!-- #include virtual = "/includes/connectDB.inc" -->
<%
PhotoId=request.QueryString("PhotoId")
ImageQuery="select Image From ImageTable where PhotoId='"&PhotoId&"'"
set rs=server.CreateObject("ADODB.recordset")
rs.open ImageQuery,conn,3,1
Response.Clear()
Response.ContentType="Image/jpeg"
Response.BinaryWrite rs("Image")
Response.End()
%>

 

Posted On: 11-Mar-2015 22:08
 Log In to Chat