当我单击 btnCheckout 时,它会给我“没有为一个或多个必需参数提供值”。
有谁知道为什么?
protected void btnCheckOut_Click(object sender, ImageClickEventArgs e)
{
string strPay = DropDownList1.Items[DropDownList1.SelectedIndex].Text;
string strDel = DropDownList2.Items[DropDownList2.SelectedIndex].Text;
OleDbConnection mDB = new OleDbConnection();
mDB.ConnectionString = "Provider = Microsoft.ACE.OLEDB.12.0;Data source="
+ Server.MapPath("~/App_Data/webBase.accdb");
string strStatus = "CheckedOut";
int intOrderNo = (int)Session["sOrderNo"];
String strSqlUpdate = "UPDATE orderInfo SET orderPayMode = @Pay, "
+ "orderDelMode = @Del, orderStatus = @Status WHERE orderNo = " + intOrderNo;
OleDbCommand cmd;
cmd = new OleDbCommand(strSqlUpdate, mDB);
cmd.Parameters.AddWithValue("@Pay", strPay);
cmd.Parameters.AddWithValue("@Del", strDel);
cmd.Parameters.AddWithValue("@Status", strStatus);
mDB.Open();
cmd.ExecuteNonQuery();
mDB.Close();
Response.Redirect("OrderDetails.aspx");
}