0
如何檢索圖像到C#winforms中的圖片框?我試過這段代碼,但我有一個參數異常,說該參數在我的位圖中是無效的。從c#winforms中的數據庫檢索圖像到圖片框
con = new SqlConnection(strConnection);
MemoryStream stream = new MemoryStream();
con.Open();
SqlCommand command = new SqlCommand(
"select companyLogo from companyDetailsTbl where companyId = 1", con);
byte[] image = (byte[])command.ExecuteScalar();
stream.Write(image, 0, image.Length);
con.Close();
Bitmap bitmap = new Bitmap(stream); //This is the error
return bitmap;