UserControl1
的UserControl1
public void showpictures()
{
{
SqlConnection conn = new SqlConnection("Data Source=BRAIANX-PC;Initial Catalog=teste;Integrated Security=True");
SqlCommand comand = new SqlCommand("select photto2 from dbo.tblProduct",conn);
conn.Open();
SqlDataReader reader = comand.ExecuteReader();
Image imagem = null;
if (reader.Read())
{
byte[] foto = (byte[])reader["photto2"];
MemoryStream ms = new MemoryStream(foto);
imagem = Image.FromStream(ms);
}
pictureBox1.Image = imagem;
}
}
public void show