order.aspx.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class order : System.Web.UI.Page
{
    String SqlStr;
    DB db = new DB();
    DataSet Ds = new DataSet();
    public void DataGridViewBind()
    {
        SqlStr = "select * from 购物车视图 where 会员名='" + Session["Username"] + "'";
        Ds = db.GetDataTableBySql(SqlStr);
        try
        {
            this.GridView1.DataSource = Ds.Tables[0].DefaultView;
            this.GridView1.DataBind();
        }
        catch(Exception)
        {
            Response.Write("<script>alert('没有得到数据,请重试!')</script>");
        }
    }
    public void total_money()
    {
        SqlStr = "select * from  购物车视图 where 会员名='" + Session["Username"] + "'";
        Ds = db.GetDataTableBySql(SqlStr);
        try
        {
            if (Ds.Tables[0].Rows.Count != 0)
            {
                Double price, sum = 0;
                int count;
                for (int i = 0; i < Ds.Tables[0].Rows.Count; i++)
                {
                    price = Double.Parse(Ds.Tables[0].Rows[i]["价格"].ToString());
                    count = int.Parse(Ds.Tables[0].Rows[i]["数量"].ToString());
                    sum += price * count;
                }
                this.total_money_txt.Text = sum.ToString();
            }
        }
        catch (Exception)
        {
            Response.Write("<script>alert('没有得到数据,请重试!')</script>");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack == false)
        {
            if (Session["Username"] != null)
            {
后面还有 42 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。