[CSHARP] try { MemoryStream ms = new MemoryStream(); pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat); byte[] arrImage = ms.GetBuffer(); ms.Close();

SqlConnection con = new SqlConnection("server=(local);trusted_connection=y es;database=DbName;"); string strSQL = "INSERT INTO TabeName (filename,pic,id) VALUES ( @filename, @pic,@id)"; SqlCommand cmd = new SqlCommand(strSQL, con);

cmd.Parameters.Add(new SqlParameter("@filename", SqlDbType.Char, 50)).Value = textBox2.Text;//filename cmd.Parameters.Add(new SqlParameter("@pic", SqlDbType.Binary)).Value = arrImage;//picture cmd.Parameters.Add(new SqlParameter("@id", SqlDbType.Char, 50)).Value = textBox3.Text;//id con.Open(); cmd.ExecuteNonQuery(); con.Close();

MessageBox.Show("Insert completed seccessfully.");; } catch (Exception ex) { MessageBox.Show(ex.Message); }[/CSHARP]