کد ارسال عکس به پیکچر باکس
SqlConnection con = new SqlConnection();
SqlCommand cmd = new SqlCommand();
string str;
str = @"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\Admin\My Documents\Visual Studio 2010\Projects\WindowsFormsApplication3\WindowsForm sApplication3\Database1.mdf;Integrated Security=True;User Instance=True";
con.ConnectionString = str;
con.Open();
string sql = "select image from pic where id='"+1+"'";
cmd.Connection = con;
cmd.CommandText = sql;
object _value;
_value = cmd.ExecuteScalar();
byte[] image = (byte[])_value;
MemoryStream ms = new MemoryStream(image);
pictureBox2.Image = Image.FromStream(ms); ;
con.Close();