G
Guest
Hi EveryBody:
I have the following code that I used in my application to retive image from
database:
Dim cnn As New SqlConnection("Data Source=localhost;Initial
Catalog=Husam;Integrated Security=True")
Dim cmd As SqlCommand
Dim sql As String
cnn.Open()
Sql = "SELECT Name,Picture FROM Pic"
cmd = New SqlCommand(sql, cnn)
Dim myReader As SqlDataReader = cmd.ExecuteReader()
While (myReader.Read())
byt = myReader.GetValue(1)
ms = New MemoryStream(byt)
End While
PictureBox1.Image = Image.FromStream(ms)
PictureBox1.ImageLocation = PictureBoxSizeMode.CenterImage
cnn.Close()
When I debug this project I got an error message that said:
Parameter is not valid and yellow line in
Pictuerbox1.image=image.fromstream(ms)
any help in this issue or any direction about how to retrive image from
database and disply it will be appreciated
regard's
Husam
I have the following code that I used in my application to retive image from
database:
Dim cnn As New SqlConnection("Data Source=localhost;Initial
Catalog=Husam;Integrated Security=True")
Dim cmd As SqlCommand
Dim sql As String
cnn.Open()
Sql = "SELECT Name,Picture FROM Pic"
cmd = New SqlCommand(sql, cnn)
Dim myReader As SqlDataReader = cmd.ExecuteReader()
While (myReader.Read())
byt = myReader.GetValue(1)
ms = New MemoryStream(byt)
End While
PictureBox1.Image = Image.FromStream(ms)
PictureBox1.ImageLocation = PictureBoxSizeMode.CenterImage
cnn.Close()
When I debug this project I got an error message that said:
Parameter is not valid and yellow line in
Pictuerbox1.image=image.fromstream(ms)
any help in this issue or any direction about how to retrive image from
database and disply it will be appreciated
regard's
Husam