By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,389 Members | 2,052 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,389 IT Pros & Developers. It's quick & easy.

Retrive an Image from database

P: n/a
Hi EveryBody:

I have the following code that I used in my application to retive image from

Dim cnn As New SqlConnection("Data Source=localhost;Initial
Catalog=Husam;Integrated Security=True")
Dim cmd As SqlCommand
Dim sql As String
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

When I debug this project I got an error message that said:

Parameter is not valid and yellow line in

any help in this issue or any direction about how to retrive image from
database and disply it will be appreciated


Nov 5 '07 #1
Share this Question
Share on Google+
1 Reply

P: n/a

This is a tip how to handle this.

It is using a reader from disk. There are a lot of samples using other
methods on our side. However this one is in my idea the best showing the

Nov 5 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.