J
James Lang
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(Constants.SQLConnectionString)
Dim myCommand As New SqlCommand("Select photo from Employees where
EmployeeID =1" , myConnection)
Dim bytes() As Byte
Try
myConnection.Open()
Dim dr As SqlDataReader
dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
Do While (dr.Read())
'Response.BinaryWrite(bytes()) myDataReader.Item("Photo"))
bytes = dr("photo")
Loop
myConnection.Close()
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
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(Constants.SQLConnectionString)
Dim myCommand As New SqlCommand("Select photo from Employees where
EmployeeID =1" , myConnection)
Dim bytes() As Byte
Try
myConnection.Open()
Dim dr As SqlDataReader
dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
Do While (dr.Read())
'Response.BinaryWrite(bytes()) myDataReader.Item("Photo"))
bytes = dr("photo")
Loop
myConnection.Close()
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