Click here to Skip to main content
15,899,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
using (SqlConnection conn = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Documents and Settings\\meekun.poon\\My Documents\\Visual Studio 2008\\Projects\\TrackLocation\\TrackLocation\\barcodePrinter.mdf;Integrated Security=True;User Instance=True"))
{


using (SqlCommand cmd = new SqlCommand("SELECT ImageName FROM Image WHERE ImageID='PL001'", conn))
{
conn.Open();
SqlDataAdapter adpt = new SqlDataAdapter(cmd);
DataSet dataSet = new DataSet();
adpt.Fill(dataSet, "Image");
DataRow Row;
Row = dataSet.Tables["Image"].Rows[0];
byte[] MyImg = (byte[])Row[0];
MemoryStream ms = new MemoryStream (MyImg);
ms.Position = 0;

pictureBox1.Image =Image.FromStream(ms); //error

}
conn.Close();
}


*****how to solve this problem??? thanks...
Posted

1 solution

Try this: pictureBox1.Image = new Bitmap(ms);
 
Share this answer
 
Comments
WinnieMeeKun 28-Nov-12 22:50pm    
Hello!!! thank you your advance..But still pop up the same message "Parameter is not valid".

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