Click here to Skip to main content
15,883,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

How can I retrieve two different images,
e.g photo, signature from sqlserver 2005 to two different picturebox in vb.net 2003?

Thanks in advance
Posted
Updated 14-Sep-11 21:38pm
v3
Comments
uspatel 15-Sep-11 3:45am    
have u tried any thing.
if you are inserting the both image url in database then i think it is no a problem to retrieve from database

1 solution

Code to retrieve image from sql server.

Public Sub Page_Load(sender As Object, e As EventArgs)

Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim myCommand As New SqlCommand("Select * from Person", myConnection)

Try
myConnection.Open()
Dim myDataReader as SqlDataReader
myDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)

Do While (myDataReader.Read())
Response.ContentType = myDataReader.Item("PersonImageType")
Response.BinaryWrite(myDataReader.Item("PersonImage"))
Loop

myConnection.Close()
Response.Write("Person info successfully retrieved!")
Catch SQLexc As SqlException
Response.Write("Read Failed : " & SQLexc.ToString())
End Try

End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900