solve this error
-
sir i want to insert data in two tables using transaction. thee is error occurs at run time . i am giving u a my code please correct it as soon as possible: con = new OleDbConnection("provider=Microsoft.Jet.Oledb.4.0;data source=E:\\db1.mdb"); com1 = new OleDbCommand("insert into info(user_id,password,name,role,email,contact,address,designation,ques,ans) values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox4.Text + "','" + comboBox1.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','" + textBox9.Text + "','" + textBox10.Text + "')"); com2 = new OleDbCommand("insert into login(user_id,password,role) values('" + textBox1.Text + "','" + textBox2.Text + "','" + comboBox1.Text + "')"); com1.Connection = con; com2.Connection = con; con.Open(); tr = con.BeginTransaction(); com1.Transaction = tr; com2.Transaction = tr; com1.ExecuteNonQuery(); com2.ExecuteNonQuery(); tr.Commit(); MessageBox.Show("inserted");
Signature preview salil_k_singh
-
sir i want to insert data in two tables using transaction. thee is error occurs at run time . i am giving u a my code please correct it as soon as possible: con = new OleDbConnection("provider=Microsoft.Jet.Oledb.4.0;data source=E:\\db1.mdb"); com1 = new OleDbCommand("insert into info(user_id,password,name,role,email,contact,address,designation,ques,ans) values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox4.Text + "','" + comboBox1.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','" + textBox9.Text + "','" + textBox10.Text + "')"); com2 = new OleDbCommand("insert into login(user_id,password,role) values('" + textBox1.Text + "','" + textBox2.Text + "','" + comboBox1.Text + "')"); com1.Connection = con; com2.Connection = con; con.Open(); tr = con.BeginTransaction(); com1.Transaction = tr; com2.Transaction = tr; com1.ExecuteNonQuery(); com2.ExecuteNonQuery(); tr.Commit(); MessageBox.Show("inserted");
Signature preview salil_k_singh
-
sir i want to insert data in two tables using transaction. thee is error occurs at run time . i am giving u a my code please correct it as soon as possible: con = new OleDbConnection("provider=Microsoft.Jet.Oledb.4.0;data source=E:\\db1.mdb"); com1 = new OleDbCommand("insert into info(user_id,password,name,role,email,contact,address,designation,ques,ans) values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox4.Text + "','" + comboBox1.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','" + textBox9.Text + "','" + textBox10.Text + "')"); com2 = new OleDbCommand("insert into login(user_id,password,role) values('" + textBox1.Text + "','" + textBox2.Text + "','" + comboBox1.Text + "')"); com1.Connection = con; com2.Connection = con; con.Open(); tr = con.BeginTransaction(); com1.Transaction = tr; com2.Transaction = tr; com1.ExecuteNonQuery(); com2.ExecuteNonQuery(); tr.Commit(); MessageBox.Show("inserted");
Signature preview salil_k_singh