0
Good afternoon, I wonder how I can recover an image saved in a database like varbinary for an img tag on Asp. My code is as follows:
<%
dim objCmdI, RsImage, vsImage
call AbreConexao()
Set RsImage = Server.CreateObject("ADODB.RecordSet")
RsImage.Open "select Imagem from Usuario",
Conn
vsImage = RsImage("Imagem")
Call FechaConexao()
%>
This is the tag I have
<img src="<%=response.Write(vsImage)%>" width="87" height="104" border="1">
The code of the Abreconexao method() :
Sub AbreConexao
Call validaAcesso(trim(request.ServerVariables("PATH_INFO")))
Set Conn = Server.CreateObject( "ADODB.Connection" )
Conn.Mode = 12
Conn.Open strConn
end sub
Note: the connection call and tag are inside the same Div. Obs2: the code Abreconexao() is in another document, but it works perfectly for other calls in the code, I’m sure the problem is not connection to the database, but rather how I am making the request to the database.
I have never worked with pure Asp code and I took it to do. I thank anyone who can help.