如何在一个按钮单击事件中编写两个插入查询? [英] How to write two insert query's in one button click event?
本文介绍了如何在一个按钮单击事件中编写两个插入查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在一个按钮单击事件中编写两个插入查询?请提供一些示例代码........
How to write two insert query''s in one button click event? please give some sample code........
推荐答案
//set your query in sqlcommand like folowing
SqlCommand cmd = new SqlCommand("Insert_Statement_1 ; Insert_Statement_2",con);
请参阅我的文章:插入,更新,搜索和删除(CRUD操作)使用ASP.Net和MySQL [ ^ ]
尽管它使用的是MySQL,但是您将对ASP.NET中的插入,更新,搜索和删除操作有所了解.此处提供示例.
祝你好运
谢谢
-Amit Gajjar
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
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();
这篇关于如何在一个按钮单击事件中编写两个插入查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文