同时对两张表执行update和insert
cn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["cn"]);
cn.Open();
SqlCommand cmd = new SqlCommand("UPDATE book SET T1= '" + Label1.Text.Replace("'", "''") + "'+'" + "/" + "'+'" + DropDownList3.Text + "'+'" + "/" + "'+'" + DropDownList1.Text + "'+'" + "-" + "'+'" + DropDownList2.Text + "'+'" + "/" + "'+ '" + TextBox4.Text.Replace("'", "''") + "'+'" + "/" + "'+'" + TextBox3.Text.Replace("'", "''") + "'+'" + "/" + "'+'" + Labelp.Text.Replace("'", "''") + "'+'" + "/" + "'+'" + Labelv.Text.Replace("'", "''") + "'+'" + "/" + "'+'" + TextBox5.Text.Replace("'", "''") + "' where booktime= '" + TextBox1.Text.Replace("'", "''") + "'", cn);
cmd.ExecuteNonQuery();
cn.Close();
Response.Write("<script>alert('预定成功')</script>");
string strm1 = "server=po-pc;database=aspnet;uid='sa';pwd='123'";
SqlConnection con = new SqlConnection(strm1); //创建连接对象
con.Open();
SqlCommand cmdm1 = new SqlCommand("insert into details (booktime,bookname) value ('" + TextBox1.Text + "', '" + Label1.Text.Replace("'", "''") + "')", con);