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;