EditShoppingCartNum.aspx.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using MyWeb.DBUtility;
using MyWeb.WebUtility;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace MyWeb
{
public partial class EditShoppingCartNum : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//输入框赋值
DBHelper db = new DBHelper();
string sql = "select * from ShoppingCart_Tbl where del=0 and id='" + Request["id"].ToString() + "'";
DataSet ds = db.Query(sql);
//将查询得到的数据赋值给文本框
if (ds.Tables[0].Rows.Count > 0)
{
//输入框的赋值
TextBox1.Text = ds.Tables[0].Rows[0]["foodsNum"].ToString();
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
DBHelper db = new DBHelper();
//声明提示类
WebHelper wb = new WebHelper();
//非空判断
if (TextBox1.Text == "")
{
wb.Alert("数量不能为空");
}
else
{
string sql = "update ShoppingCart_Tbl set foodsNum='" + TextBox1.Text + "' where del=0 and id='" + Request["id"].ToString() + "'";
int renum = db.ExecuteSql(sql);
if (renum == 1)
{
//成功
wb.Alert("修改购物车数量成功!", "MyShoppingCart.aspx");
}
else
{
//失败
wb.Alert("添加商品种类信息失败!");
}
}
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("MyShoppingCart.aspx");
后面还有 3 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
