 |
|
ขอสอบถาม เรื่องการ ดึงข้อมูลมาก SQL มาแสดงที่ PicBox ใน เฟรม โดยในเฟรม ไม่มี ดาต้ากริด(Vb.NET) |
|
 |
|
|
 |
 |
|
หาวิธีเชื่อมต่อกับ Database ให้ได้ก่อนครับ ที่เหลือไม่ยากครับ
ลองดูครับ
Code (VB.NET)
connection.Open();
SqlCommand command1 = new SqlCommand("select imgfile from myimages where imgname=@param", connection);
SqlParameter myparam = command1.Parameters.Add("@param", SqlDbType.NVarChar, 30);
myparam.Value = txtimgname.Text;
byte[] img = (byte[])command1.ExecuteScalar();
MemoryStream str = new MemoryStream();
str.Write(img, 0, img.Length);
Bitmap bit = new Bitmap(str);
Response.ContentType = "image/jpeg";
bit.Save(Response.OutputStream, ImageFormat.Jpeg);
connection.Close();
Go to : VB.NET สอบถามวิธีการดึงรูปภาพที่บันทึกไว้(เป็น Binary data)ในฐานข้อมูลเอามาแสดงใน PictureBox ครับ
Go to : นำไฟล์รูปภาพใน SQL Server 2005 มาแสดงใน PictureBox VB.NET
Go to : c# win มันอะไรกันนักหนาเนี่ย image + picturebox เนี่ย
ลองดูครับ
Code (VB.NET)
connection.Open();
SqlCommand command1 = new SqlCommand("select imgfile from myimages where imgname=@param", connection);
SqlParameter myparam = command1.Parameters.Add("@param", SqlDbType.NVarChar, 30);
myparam.Value = txtimgname.Text;
byte[] img = (byte[])command1.ExecuteScalar();
MemoryStream str = new MemoryStream();
str.Write(img, 0, img.Length);
Bitmap bit = new Bitmap(str);
Response.ContentType = "image/jpeg";
bit.Save(Response.OutputStream, ImageFormat.Jpeg);
connection.Close();
Go to : VB.NET สอบถามวิธีการดึงรูปภาพที่บันทึกไว้(เป็น Binary data)ในฐานข้อมูลเอามาแสดงใน PictureBox ครับ
Go to : นำไฟล์รูปภาพใน SQL Server 2005 มาแสดงใน PictureBox VB.NET
Go to : c# win มันอะไรกันนักหนาเนี่ย image + picturebox เนี่ย
|
 |
 |
 |
 |
Date :
2017-11-29 14:10:32 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|