asp.net 一个按钮实现两个功能 10
希望按钮点击之后,先把a2表中的数据写入a1,然后a2表中的相应数据删除,希望大神们尽快解答!!代码如下:protectedvoidButton1_Click(objec...
希望按钮点击之后,先把a2表中的数据写入a1,然后a2表中的相应数据删除,希望大神们尽快解答!!代码如下:
protected void Button1_Click(object sender, EventArgs e)
{
string constr = "Provider= Microsoft.Jet.OLEDB.4.0; Data Source=C:/Users/shl/WebSite1/App_Data/注册12.mdb; User Id=admin; Password=";
OleDbConnection conn = new OleDbConnection(constr);
conn.Open();
string tongguo;
tongguo = "insert into a1 select * from a2";
OleDbCommand insert = new OleDbCommand(tongguo, conn);
insert.ExecuteNonQuery();
string shanchu = "delete * from a2";
OleDbCommand delete = new OleDbCommand(shanchu, conn);
delete.ExecuteNonQuery();
conn.Close();
} 展开
protected void Button1_Click(object sender, EventArgs e)
{
string constr = "Provider= Microsoft.Jet.OLEDB.4.0; Data Source=C:/Users/shl/WebSite1/App_Data/注册12.mdb; User Id=admin; Password=";
OleDbConnection conn = new OleDbConnection(constr);
conn.Open();
string tongguo;
tongguo = "insert into a1 select * from a2";
OleDbCommand insert = new OleDbCommand(tongguo, conn);
insert.ExecuteNonQuery();
string shanchu = "delete * from a2";
OleDbCommand delete = new OleDbCommand(shanchu, conn);
delete.ExecuteNonQuery();
conn.Close();
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询