Click here to Skip to main content
14,599,019 members
Rate this:
Please Sign up or sign in to vote.
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

Rate this:
Please Sign up or sign in to vote.

Solution 1

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
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100