private void button2_Click(object sender, EventArgs e) { NWDB.NWDB mydb = new NWDB.NWDB(); NWDB.Define.IProduct ip = new NWDB.Features.ProductImpl(mydb.Conn); DataTable tt = ip.SearchProduct(); mydb.DbClose(); if (tt != null) { dataGridView1.DataSource = tt; } else { dataGridView1.DataSource = null; MessageBox.Show("查無任何資料!"); } }
private void button4_Click(object sender, EventArgs e) { NWDB.NWDB mydb = new NWDB.NWDB(); NWDB.Define.IProduct ip = new NWDB.Features.ProductImpl(mydb.Conn); Bitmap pp = ip.GetProductPic(int.Parse(textBox2.Text)); mydb.DbClose(); if (pp != null) { PicLabel.Text = ""; PicLabel.AutoSize = false; PicLabel.Size = pp.Size; PicLabel.Image = pp; } else { MessageBox.Show("沒有圖片!"); } }
private void GetProductPic(int pid) { NWDB.NWDB mydb = new NWDB.NWDB(); NWDB.Define.IProduct ip = new NWDB.Features.ProductImpl(mydb.Conn); Bitmap pp = ip.GetProductPic(pid); mydb.DbClose(); if (pp != null) { PicLabel.Text = ""; PicLabel.AutoSize = false; PicLabel.Size = pp.Size; PicLabel.Image = pp; } else { MessageBox.Show("沒有圖片!"); } }