I am storing the image in a database and using c#
as the front end.
I am storing the image by converting into binary format.
How can I retrieve the image stored in binary format from database?
I am storing the image in a database and using c#
as the front end.
I am storing the image by converting into binary format.
How can I retrieve the image stored in binary format from database?
Maybe this will help:
OdbcConnection con = new OdbcConnection(ConnectString);
con.Open();
OdbcCommand checkcommand = new OdbcCommand("SELECT contents FROM MyTable WHERE MyClause", con);
OdbcDataReader checkreader = checkcommand.ExecuteReader();
byte[] array = null;
if (checkreader.Read())
array = (byte[])checkreader.GetValue(0);
else
{
//Error
return false;
}
File.WriteAllBytes("C:\\MyImage.jpeg", array);