0

Getting image datatype from sql to c# using output parameter

How? Pls tell me.. thank u!

27th Dec 2019, 12:24 PM
Miki Yas
1 Réponse
+ 3
Example connection.Open(); SqlCommand command1 = new SqlCommand("select imgfile from myimages where imgname=@param", connection); SqlParameter myparam = command1.Parameters.Add("@param", SqlDbType.NVarChar, 30); myparam.Value = txtimgname.Text; byte[] img = (byte[])command1.ExecuteScalar(); MemoryStream str = new MemoryStream(); str.Write(img, 0, img.Length); Bitmap bit = new Bitmap(str); connection.Close(); For more data https://stackoverflow.com/questions/2175209/retrieve-images-from-sql-server-database
23rd Feb 2020, 12:57 PM
hossein B
hossein B - avatar