Send.aspx<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Send.aspx.cs" Inherits="Send" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页 </title>
<script type="text/javascript">
function SendData()
{
var seat="S006";
var xh = new ActiveXObject("MSXML2.XMLHTTP");
xh.open("POST","Do.aspx",false);
xh.send(document.all.txtUser.value);
}
</script>
</head>
<body>
<form id="form1" runat="server" method="post">
<div>
<input id="txtUser" type="text" runat="server" />
<input id="Button1" type="button" value="button" onclick="SendData()"/>
</div>
</form>
</body>
</html> Do.aspx.cspublic partial class Do : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ SqlConnection con = new SqlConnection("Data Source=7E2DF151D5144A0\\SQLEXPRESS;Initial Catalog=TicketBook;Integrated Security=True");
con.Open();
SqlCommand cmd = new SqlCommand("update Seat set i_SeatState =@seatState where c_SeatCode=@seatCode", con);
cmd.Parameters.AddWithValue("@seatState", "1");
cmd.Parameters.AddWithValue("@seatCode", "S006");
cmd.ExecuteNonQuery();
con.Close();
}
}但是数据库里面没有改变,就是说Do.aspx没有执行,哪里错了呢?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货