//获取数据库里的图片代码(省略)
object ob = dataTable.Rows[0]["图片"];
byte[] buff = ob as byte[];
if (ob == null)
{
//报错
return;
}
MemoryStream ms = new MemoryStream(buff, 0, buff.Length, true);
Bitmap bt = Bitmap.FromStream(ms) as Bitmap;
if (bt == null)
{
//数据格式错误,请检查是否是图片
return;
}
ms.Flush();
ms.Close();
//把bt显示出来,比如 pictureBox.Image = bt;