السلام عليكم
هذا كود الحفظ وهو يعمل جيداً
//insert code
string JSS_connetionString004 = null;
OleDbConnection JSS_connection004;
OleDbDataAdapter JSS_oledbAdapter004 = new OleDbDataAdapter();
string JSS_sql004 = null;
JSS_connetionString004 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|/je_salestoredb.mdb;Persist Security Info=True;Jet OLEDB:Database Password=JE2014";
JSS_connection004 = new OleDbConnection(JSS_connetionString004);
JSS_sql004 = "insert into control_room(coroom_ID,coroom_OPERATION,coroom_EMPLOYEE,coroom_USER,coroom_INVOICE_NUM,coroom_SUPPLIER,coroom_CUSTOMER,coroom_USER_CHANGE,coroom_DATE,coroom_TIME,coroom_STATUS) values('" + JSS_str_control_room_ID2 + "','" + JSS_coroom_OPERATION + "','" + JSS_coroom_EMPLOYEE + "','" + JSS_coroom_USER + "','" + JSS_coroom_INVOICE_NUM + "','" + JSS_coroom_SUPPLIER + "','" + JSS_coroom_CUSTOMER + "','" + JSS_coroom_USER_CHANGE + "','" + JSS_coroom_DATE + "','" + JSS_coroom_TIME + "','" + JSS_coroom_STATUS + "')";
try
{
JSS_connection004.Open();
JSS_oledbAdapter004.InsertCommand = new OleDbCommand(JSS_sql004, JSS_connection004);
JSS_oledbAdapter004.InsertCommand.ExecuteNonQuery();
}
catch (Exception ex)
{
}ام اكودا التعديل و الحذف فلا تعمل مع ان الكود يُنفذ بدون ظهور اخطاء وتظهر رسالة تفيد بأنه تم التعديل
//edit
string JSS_connetionString011 = null;
OleDbConnection JSS_connection011;
OleDbDataAdapter JSS_oledbAdapter011 = new OleDbDataAdapter();
string JSS_sql011 = null;
JSS_connetionString011 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|/je_salestoredb.mdb;Persist Security Info=True;Jet OLEDB:Database Password=JE2014";
JSS_connection011 = new OleDbConnection(JSS_connetionString011);
JSS_sql011 = "update product_companies set prodc_NAME = '" + textBox1.Text + "',prodc_BARCODE = '" + textBox2.Text + "' where prodc_ID = '" + label3.Text + "'";
try
{
JSS_connection011.Open();
JSS_oledbAdapter011.UpdateCommand = JSS_connection011.CreateCommand();
JSS_oledbAdapter011.UpdateCommand.CommandText = JSS_sql011;
JSS_oledbAdapter011.UpdateCommand.ExecuteNonQuery();
MessageBox.Show("تم تعديل البيانات", "تم التعديل", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}string JSS_connetionString001 = null;
OleDbConnection JSS_connection001;
OleDbDataAdapter JSS_oledbAdapter001 = new OleDbDataAdapter();
string JSS_sql001 = null;
JSS_connetionString001 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|/je_salestoredb.mdb;Persist Security Info=True;Jet OLEDB:Database Password=JE2014";
JSS_connection001 = new OleDbConnection(JSS_connetionString001);
JSS_sql001 = "delete from product_companies where prodc_ID = '" + label3.Text + "'";
try
{
JSS_connection001.Open();
JSS_oledbAdapter001.DeleteCommand = JSS_connection001.CreateCommand();
JSS_oledbAdapter001.DeleteCommand.CommandText = JSS_sql001;
JSS_oledbAdapter001.DeleteCommand.ExecuteNonQuery();
MessageBox.Show("تم حذف المجموعة", "تم الحذف", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}رجاء المساعدة