1个回答
展开全部
protected void LoadImage(string sql)
{
SqlConnection Conn = new SqlConnection("链接字符串");
Conn.Open();
SqlCommand cmd = new SqlCommand(sql, Conn);
byte[] fileData = (byte[])cmd.ExecuteScalar();
Conn.Close();
System.IO.MemoryStream ms = new System.IO.MemoryStream(fileData);
System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
img.Save("C:\\aa.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
}
{
SqlConnection Conn = new SqlConnection("链接字符串");
Conn.Open();
SqlCommand cmd = new SqlCommand(sql, Conn);
byte[] fileData = (byte[])cmd.ExecuteScalar();
Conn.Close();
System.IO.MemoryStream ms = new System.IO.MemoryStream(fileData);
System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
img.Save("C:\\aa.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
}
追问
System.Drawing.Image
Image 点不出来为什么
追答
程序集添加System.Drawing引用
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询