郁闷了好几天了啊,各位请帮我看看啊
一段从数据库提取图片的代码,为什么有错呢?
SqlConnection conn=new SqlConnection("Data Source=ms-p4;Initial Catalog=northwind;user id=coins.net;password=coins.net");
conn.Open();
SqlCommand com=new SqlCommand("select imagedata from image",conn);
byte[]image=(byte[])com.ExecuteScalar();
MemoryStream ms=new MemoryStream(image,true);
ms.Write(image,0,image.Length);
Bitmap bmap=new Bitmap(ms);
ms.Close();
conn.Close();
return bmap;
这样运行到byte[]image=(byte[])com.ExecuteScalar();的时候出现
未处理的“System.Data.SqlClient.SqlException”类型的异常出现在 system.data.dll 中
其他信息:系统错误。
这样的异常,怎么回事呢?