Hii everyone,
i'm beginner. After many tries error is still exist (error : input string is incorrect format !! How to solve this error??)
this is my code :
int x;
string conString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=..\\..\\org.accdb";
OleDbConnection con = new OleDbConnection(conString);
DataTable dt = new DataTable();
OleDbDataAdapter oda = new OleDbDataAdapter();
oda.UpdateCommand = new OleDbCommand("update student set id_civil_st=@id_civil_st,names=@names,phone=@phone,address=@address,school_ year=@school_ year,amount_ paid=@amount_ paid,amount_rest=@amount_rest,date_record=@date_record,date_start=@date_start,date_end=@date_end where sn_s=@sn_s", con);
oda.UpdateCommand.Parameters.Add("@id_civil_st", OleDbType.Char).Value = id_civil_st.Text;
oda.UpdateCommand.Parameters.Add("@names", OleDbType.Char).Value = names.Text;
oda.UpdateCommand.Parameters.Add("@phone", OleDbType.Char).Value = phone.Text;
oda.UpdateCommand.Parameters.Add("@address", OleDbType.Char).Value = address.Text;
oda.UpdateCommand.Parameters.Add("@school_ year", OleDbType.Char).Value = textBox2.Text;
oda.UpdateCommand.Parameters.Add("@amount_ paid", OleDbType.Currency).Value =Convert.ToDecimal( textBox3.Text);
oda.UpdateCommand.Parameters.Add("@amount_rest", OleDbType.Currency).Value =Convert.ToDecimal( textBox4.Text);
oda.UpdateCommand.Parameters.Add("@date_record", OleDbType.Date).Value =Convert.ToDateTime( textBox5.Text);
oda.UpdateCommand.Parameters.Add("@date_start", OleDbType.Date).Value =Convert.ToDateTime( textBox6.Text);
oda.UpdateCommand.Parameters.Add("@date_end", OleDbType.Date).Value =Convert.ToDateTime( textBox7.Text);
oda.UpdateCommand.Parameters.Add("@sn_s", OleDbType.Integer).Value =Convert .ToInt32( sn_s.Text);
con.Open();
x = oda.UpdateCommand.ExecuteNonQuery();
con.Close();
if (x >= 1)
MessageBox.Show("Records has been updated");