Display an Image in a SQL Database
second option :
in file test.html, put this code :-
<img src=”image.asp?id=1″>
then, in same directory, make file image.asp
and put this code :-
<%
Response.ContentType = “image/gif”
Response.Expires = 0
Response.Buffer = TRUE
Response.Clear
id = Request.QueryString(“id”)
`checking the data exist or not
`Server Name=test
`SQL Server database name=test
cme = “DRIVER={SQL SERVER};SERVER=test;UID=sa;pwd=;DATABASE=test”
`field ImageItem is image datatype in SQL Server.
cmdsql = “SELECT ImageItem from EQUIPMENT WHERE id =`”&id&”`”
set rs = Server.CreateObject(“adodb.Recordset”)
rs.open cmdsql, cme
Response.BinaryWrite rs(“ImageItem”)
Response.End
%>

No comments yet
Comments feed for this article