السلام عليكم ,
يظهر خطأ عند تنفيذ هذا الكود في السطر
pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
والخطأ هو
Object reference not set to an instance of an object.
ما الحل وشكراً
OleDbConnection JSS_cn001 = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|/JE_SaleStoreDB.mdb;Persist Security Info=True;Jet OLEDB:Database Password=JE2014");
System.IO.MemoryStream ms = new System.IO.MemoryStream();
pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
byte[] rawdata = ms.GetBuffer();
OleDbCommand Cmd = new OleDbCommand("update company_info set companyinfo_NAME = '" + textBox1.Text + "', companyinfo_BRANCHE = '" + textBox2.Text + "', companyinfo_ADDRESS = '" + textBox3.Text + "', companyinfo_TEL1 = '" + textBox4.Text + "' , companyinfo_TEL2 = '" + textBox5.Text + "' , companyinfo_TEL3 = '" + textBox6.Text + "' , companyinfo_TEL4 = '" + textBox7.Text + "' , companyinfo_EMAIL = '" + textBox8.Text + "', companyinfo_WEB = '" + textBox10.Text + "', companyinfo_FACEBOOK = '" + textBox11.Text + "', companyinfo_LOGO = @Img WHERE companyinfo_ID='1', JSS_cn001");
JSS_cn001.Open();
Cmd.Parameters.AddWithValue("@Img", rawdata);
Cmd.ExecuteNonQuery();
Cmd.Dispose();
JSS_cn001.Close();
