Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello..
I want to save/fetch image from picturebox/mysql to mysql/picturebox
I'm able to store the image into mysql. Lemme tel u one thing is, after saving i checked that image is saving in bytes format. Moreover im unable to fetch it back.

What i did to fetch the image is ..
con.Open();
            MySqlCommand da=new MySqlCommand("select smn_pho from smn where smn_nme='testing'",con);
            MySqlDataReader ds = da.ExecuteReader();
            DataTable dt = new DataTable();
            dt.Load(ds);
using (MemoryStream ms = new MemoryStream((byte[])dt.Rows[0]["smn_pho"]))
        {
            ms.Position = 0;
            ms.Seek(0, SeekOrigin.Begin);
            pictureBox2.Image = System.Drawing.Image.FromStream(ms);//Throwing error at this location as Parameter not found...
            ms.Flush();
            ms.Close();
        }
Posted
Updated 7-Feb-11 23:49pm
v2

1 solution

 
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