ashx页面MemoryStreamstream=newMemoryStream();SqlConnectionconnection=newSqlConnection("省略。。。");try{connection.Open();SqlCommandcommand=newSqlCommand("selectWishImage...
ashx页面
MemoryStream stream = new MemoryStream();
SqlConnection connection = new SqlConnection("省略。。。");
try
{
connection.Open();
SqlCommand command = new SqlCommand("select WishImage from Wish ", connection);
byte[] image = (byte[])command.ExecuteScalar();
stream.Write(image, 0, image.Length);
Bitmap bitmap = new Bitmap(stream);
context.Response.ContentType = "image/jpeg";
bitmap.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
}
finally
{
connection.Close();
stream.Close();
}
aspx页面
用了以上方法,只能读取到数据库中的第一张图片,不能显示所有的WishImage
求大神帮忙修改一下
展开