⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 order_detail.aspx.cs

📁 B2B网上商城
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


using System.Data.SqlClient;
public partial class Order_Detail : System.Web.UI.Page
{
    public SqlDataReader dr;
    public string store, salesid, buyerid, ordertime, productid, quantity, 
                  posttype, postprice, producttotal, payment, consigneename, 
                  consigneepost, consigneeadress, telephone, mobilePhone, productprice;
    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            SqlConnection connection = new SqlConnection(ConfigurationManager.AppSettings["ConnStr"]);//调用Web.config连接数据库

            String sql = "SELECT top 1 * FROM Orders where BuyerId='" + Session["username"].ToString() + "' order by OrderId desc"; //数据库连接字符串

            SqlCommand command = new SqlCommand(sql, connection);//构件执行数据命令
            connection.Open();//打开数据库
            dr = command.ExecuteReader();//保存从数据库里面返回的一条记录

            if (dr.Read())
            {
                store = dr["Store"].ToString();
                salesid = dr["SalesId"].ToString();
                buyerid = dr["BuyerId"].ToString();
                ordertime = dr["OrderTime"].ToString();
                productid = dr["ProductId"].ToString();
                quantity = dr["Quantity"].ToString();
                posttype = dr["PostType"].ToString();
                postprice = dr["PostPrice"].ToString();
                producttotal = dr["ProductTotal"].ToString();
                payment = dr["Payment"].ToString();
                consigneename = dr["ConsigneeName"].ToString();
                telephone = dr["Telephone"].ToString();
                mobilePhone = dr["MobilePhone"].ToString();
                productprice = dr["ProductPrice"].ToString();
                consigneepost = dr["ConsigneePost"].ToString();
                consigneeadress = dr["ConsigneeAdress"].ToString();
            }
            lblStore.Text = store;
            lblSalesId.Text = salesid;
            lblConsigneeAdress.Text = consigneeadress;
            lblOrderTime.Text = ordertime;
            lblProductPrice.Text = productprice;
            lblConsigneePost.Text = consigneepost;
            lblPostPrice.Text = postprice;
            lblPayment.Text = payment;
            lblConsigneeName.Text = consigneename;
            lblTelephone.Text = telephone;
            lblMobilePhone.Text = mobilePhone;
            lblProductTotal.Text = producttotal;
            lblQuantity.Text = quantity;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -