c# 数据库的二进制数据 还原成图片文件
数据来源myAdapter = new SqlDataAdapter(myCmd); 保存到datatable里面DataTable domainTd = db.returnDataTable(sql, conn) 然后循环datatable
数据转换:byte[] pics1 = (byte[])domainTd.Rows[k]["OldImg"];
生成文件代码:
public void writePic(byte[] pics)
{
FileStream fs = new FileStream(@"E:\123.jpg", FileMode.Append, FileAccess.Write);
BinaryWriter bw = new BinaryWriter(fs);
bw.Write(pics, 0, pics.Length);
bw.Close();
fs.Close();
}
补充:软件开发 , C# ,