Hi
I am trying to display in an aspx page an image from the employees table in
the sql server 2000 Northhwind database
"Select photo from employees where employeeid = 1"
This is as far a I got
=============== =============== =============== =============== =============== =
=============== ==
Dim myConnection As New SqlConnection(C onstants.SQLCon nectionString)
Dim myCommand As New SqlCommand("Sel ect photo from Employees where
EmployeeID =1" , myConnection)
Dim bytes() As Byte
Try
myConnection.Op en()
Dim dr As SqlDataReader
dr = myCommand.Execu teReader(Comman dBehavior.Close Connection)
Do While (dr.Read())
'Response.Binar yWrite(bytes()) myDataReader.It em("Photo"))
bytes = dr("photo")
Loop
myConnection.Cl ose()
Response.Write( "Person info successfully retrieved!")
Catch SQLexc As SqlException
lblError.Text = SQLexc.Message
end try
=============== =============== =============== =============== =============== =
=============== ==
I am at a loss with what to do with the byte array next.
All I could think of was write it to a file then reference that as the URL
for an image control
But I am sure there is a better way
Any help regarding this would be great
Cheers
James
Comment