Hi there,
I am trying to retrieve and view in a picturebox, an image I saved in mysql database as an image data type. When I open my database I see in the image column " "
Now I am trying to select data and along with it this image, below is the code i thought would work.
private void button2_Click(object sender, EventArgs e)
{
SqlConnection cn = new SqlConnection("Data Source=KATOTO-PC;Initial Catalog =AssetRegister;User ID=sa;Password=Kyozi");
string sql = ("select serialnumber,supplier,assetimage from AssetInformation where serialnumber like '" + textBox1.Text + "'");
SqlCommand cmd = new SqlCommand(sql, cn);
cn.Open();
SqlDataReader sdr = cmd.ExecuteReader();
sdr.Read(); // read first row
textBox2.Text = sdr[1].ToString(); // read first column
pictureBox2.Image = sdr[2].ToString();
}
I can't even run because of a number of errors.
Any help will be kindly appreciated.
Best regards.

Mahesh ChandPosted Mar 7, 2012, 10:47 AM
Marvin kakuruPosted Mar 7, 2012, 10:32 AM
kindly show me an example of how i can view an image selected from a database where it was saved and is in binary form
Sam HobbsPosted Mar 7, 2012, 8:49 AM