Posted on: 1/23/2015 12:19:57 PM | Views : 667

Hello All,
Am using this code below to convert varbinary into an image. How can i dispaly this in a gridview for each item.
Thanks in advance
SqlConnection conn = new SqlConnection(strconnection); SqlDataAdapter sda = new SqlDataAdapter("select Front_Image,Rear_Image from Transactions", conn); DataTable dt = new DataTable(); sda.Fill(dt); foreach (DataRow row in dt.Rows) { //Get the byte array from image file byte[] imgBytes = (byte[])row["Front_Image"]; byte[] RimgBytes = (byte[])row["Rear_Image"]; //If you want convert to a bitmap file TypeConverter tc = TypeDescriptor.GetConverter(typeof(Bitmap)); Bitmap MyBitmap = (Bitmap)tc.ConvertFrom(imgBytes); Bitmap RMyBitmap = (Bitmap)tc.ConvertFrom(RimgBytes); ...

Go to the complete details ...