當前位置:編程學習大全網 - 電腦編程 - c#怎麽把二進制數據轉換為圖片

c#怎麽把二進制數據轉換為圖片

請確認妳的Image列是什麽數據類型!

參考下面的代碼:

public void GetImage()

{

SqlCommand cmd = new SqlCommand(@"SELECT name, photo FROM Temp", sqlConn);

sqlConn.Open();

SqlDataReader reader = cmd .ExecuteReader();

if (reader.Read())

{

image_filename= (string) reader.GetValue(0);

byte[] image_bytes = (byte[]) reader.GetValue(1);

MemoryStream ms = new MemoryStream(image_bytes);

Bitmap bmap = new Bitmap(ms);

return bmap;

}

  • 上一篇:有哪位高手幫忙用mathematica編寫程序畫出三維空間上的100步按格點的隨機遊走,標好箭頭,最好能有顏色變化
  • 下一篇:海爾樂信雲科技有限公司怎麽樣
  • copyright 2024編程學習大全網