我在读数据的图片是总出现这句话“无法将类型为“System.Int32”的对象强制转换为类型“System.Byte[]”。
conn.Open();SqlCommandcmd=newSqlCommand("select*fromimageswhereimageid=1",conn);SqlDa...
conn.Open ();
SqlCommand cmd = new SqlCommand("select * from images where imageid=1", conn);
SqlDataReader reader = cmd.ExecuteReader();
reader.Read();
MemoryStream buf = new MemoryStream((byte[])reader[0]);
Image image = Image.FromStream(buf, true);
pictureBox1.Image = image; 展开
SqlCommand cmd = new SqlCommand("select * from images where imageid=1", conn);
SqlDataReader reader = cmd.ExecuteReader();
reader.Read();
MemoryStream buf = new MemoryStream((byte[])reader[0]);
Image image = Image.FromStream(buf, true);
pictureBox1.Image = image; 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询