我的代码是......
public DataTable GET_IMAGE_PRODUCT(int ID)
{
DAL.DataAccessLayer DAL = new DAL.DataAccessLayer();
DataTable Dt = new DataTable();
SqlParameter[] param = new SqlParameter[1];
param[0] = new SqlParameter("@ID", SqlDbType.VarChar,50);
param[0].Value = ID;
Dt = DAL.SelectData("GET_IMAGE_PRODUCT", param);
DAL.Close();
return Dt;
}
和
private void button6_Click(object sender, EventArgs e)
{
FRM_PREVIEW frm = new FRM_PREVIEW();
byte[] image = (byte[])prd.GET_IMAGE_PRODUCT(this.dataGridView1.CurrentRow.Cells[0].Value.GetHashCode()).Rows[0][0];
MemoryStream ms = new MemoryStream(image);
frm.pictureBox1.Image = Image.FromStream(ms);
frm.ShowDialog();
}
所以如果没有图像,我想显示一条消息。