Click here to Skip to main content
15,913,773 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to write two insert query's in one button click event? please give some sample code........
Posted
Comments
Sangramsingh Pawar 18-Aug-12 4:33am    
are they belongs to same table?

C#
//set your query in sqlcommand like folowing
SqlCommand cmd = new SqlCommand("Insert_Statement_1 ; Insert_Statement_2",con);
 
Share this answer
 
Hi,

Please Refer My Article : Insert, Update, Search and Delete (CRUD operation) using ASP.Net and MySQL[^]

Although it is using MySQL but you will get some idea about inset,update, Search and Delete operation in ASP.NET. Examples are available there.

Best of luck

Thanks
-Amit Gajjar
 
Share this answer
 
C#
connect();
String s1 = "insert into tbl_1(client_id,name,address,profession,bankName) values('" + maskedTextBox49.Text + "','" + maskedTextBox2.Text + "','" + maskedTextBox3.Text + "','" + maskedTextBox4.Text + "','" + maskedTextBox1.Text + "');insert into tbl_2(client_id) values('" + maskedTextBox49.Text + "')";
SqlCommand cmd = new SqlCommand(s1);
cmd.Connection = con;
cmd.ExecuteNonQuery();
disConnect();
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900