Click here to Skip to main content
15,844,155 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i saved a image into sql server...
i couldn't view that image...
Aravindba 5-Mar-14 2:14am    
which format u saved in sql server ? binary ?
Bernhard Hiller 5-Mar-14 2:15am    
How is that image stored - path to a network share, path accessible to a server of a client-server-application, as binary data in a blob (plus additional information on the picture type in a different column or not), ...?
Raajkumar.b 5-Mar-14 2:18am    
check it u will get an idea
Vedat Ozan Oner 5-Mar-14 2:37am    
google answers this question in 0.19 seconds:
Member 10339067 5-Mar-14 2:45am    
i saved in image datatype

1 solution

Please refer the link
Share this answer
Member 10339067 5-Mar-14 4:32am    
already i used this... but not working
nandakishoreroyal 5-Mar-14 4:36am    
Can you update the code what you have used?
Member 10339067 5-Mar-14 4:39am    
SqlDataAdapter adapter1 = new SqlDataAdapter("SELECT Photo FROM tblPatientDetails WHERE PatientID=" + Convert.ToInt32((txtPatientID.Text)) + "", con);
DataTable datatable = new DataTable();
if (datatable.Rows.Count > 0)
byte[] picArray = (byte[])dt.Rows[0]["Photo"];
MemoryStream ms = new MemoryStream(picArray);
ms.Seek(0, SeekOrigin.Begin);
//pictureBoxDisplay.Image = Image.FromStream(ms);
//pictureBoxDisplay.Image = ByteToImage(picArray);

MemoryStream mStream = new MemoryStream();
// byte[] pData = picArray;
mStream.Write(picArray, 0, Convert.ToInt32(picArray.Length));
Bitmap bm = new Bitmap(mStream, false);
pictureBoxDisplay.Image = bm;


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