Settlement.aspx.cs

(开头部分) 3KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using ClassLibrary2;
using System.Net.Mail;
using System.Text;

public partial class Settlement1 : System.Web.UI.Page
{
    string str = System.Configuration.ConfigurationManager.AppSettings["str_con"].ToString(); //连接数据库
 
    string Order = DateTime.Now.Year.ToString().Substring(2, 2) + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Day.ToString().PadLeft(2, '0') + DateTime.Now.Hour.ToString().PadLeft(2, '0') + DateTime.Now.Minute.ToString().PadLeft(2, '0') + DateTime.Now.Second.ToString().PadLeft(2, '0') + DateTime.Now.ToString("fff");
    string time = DateTime.Now.ToString();
    string Email = "";
    SqlConnection con = null;
    SqlCommand cmd = null;
    protected void Page_Load(object sender, EventArgs e)
    {
       
        if (!IsPostBack)
        {
            bind();
        }
    }
    public void bind()
    {
        con = new SqlConnection(str);
        string str_cmd = "SELECT 购物车信息表.Commodity_Name as 名称,Num as 数量,英雄信息表.英雄类型 ,单价,Num*单价 as 合计,顾客信息.username as 用户名,realname as 姓名,phone as 电话,address as 地址,email FROM 购物车信息表,英雄信息表,顾客信息 where 购物车信息表.Commodity_Name = 英雄信息表.英雄名称 and flag='1' and 顾客信息.username = 购物车信息表.yh_id and 购物车信息表.yh_id='" + Session["login"] + "' ";
        con.Open();
        cmd = new SqlCommand(str_cmd, con);
        if (cmd.ExecuteScalar() != null)
        {
            SqlDataReader dr = cmd.ExecuteReader();
            dr.Read();
            Label2.Font.Size=20;
            Label3.Font.Size = 15;
            Label4.Font.Size = 15; 
            Label2.Text = "用户:"+dr["用户名"].ToString() + "订单信息";
            Label3.Text = "收货人:  " + dr["姓名"].ToString() + "联系电话: " + dr["电话"].ToString();
            Label4.Text = "收货地址:  " + dr["地址"].ToString();
            Email = dr["email"].ToString();
            dr.Close();
        }
        SqlDataAdapter da = new SqlDataAdapter(str_cmd, con);
        DataSet ds = new DataSet();
        da.Fill(ds);
        GridView1.DataSource = ds;
        GridView1.DataBind();
        con.Close();
        double sum = 0;
        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            sum += Convert.ToDouble(GridView1.Rows[i].Cells[4].Text);
        }
        Label1.Font.Size = 15;
后面还有 33 行代码,购买后查看完整代码

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

AI 解读 AI

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

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