數據來源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();
}