在上一页我有
protected void SqlCheckout_Inserted(object sender, SqlDataSourceStatusEventArgs e)
{
string CustID;
if (e.Exception == null)
{
CustID = e.Command.Parameters["@CustomerID"].Value.ToString();
Response.Redirect("Payment.aspx?id=" + CustID);
}
}
然后在我的付款页面
protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
int intCustID;
int intOrderID;
intCustID = int.Parse(Request.QueryString["CustomerID"]);
//save shopping cart
ShoppingCart objCart;
//retreive shoppping cart from session
objCart = (ShoppingCart)Session["shoppingCart"];
//the shopping cart cannot be empty
if (objCart != null)
{
//save Cart
intOrderID = objCart.SaveCart(intCustID);
e.Values["OrderID"] = intOrderID;
Session["OrderID"] = intOrderID;
}
else
{
e.Cancel = true;
}
}
我遵循教程编辑:这允许我将数据插入数据库,并且由于某种原因在这行代码中我收到错误消息说输入字符串格式不正确编辑:并且“值不能为空”...有小费吗?