Posted on: 12/24/2014 11:34:07 AM | Views : 601

Hello All,
I am using the c# code below to same an .bmp image file as varbinary into a database.
Can someone please help me on how to retrieve the it back into an image in a picturebox or radbinaryimage control.
string filePath = @"C:\Users\KeeEdwins\Desktop\Cheque Images\TXN20141127-171716+0#0f01.JPEG"; FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); Byte[] bytes = br.ReadBytes((Int32)fs.Length); br.Close(); fs.Close(); SqlConnection conn = new SqlConnection(strconnection); conn.Open(); SqlCommand cmd = new SqlCommand("INSERT INTO Transactions(Front_Image) VALUES (@Front_Image)", conn); cmd.Parameters.AddWithValue("@Front_Image", bytes); cmd.ExecuteNonQuery(); conn.Close();
Thanks

Go to the complete details ...