📄 order_detail.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Configuration;
namespace B2Bsite
{
/// <summary>
/// 显示订单完成后 信息
/// </summary>
public class Order_Detail : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lblStore;
protected System.Web.UI.WebControls.Label lblSalesId;
protected System.Web.UI.WebControls.Label lblConsigneeAdress;
protected System.Web.UI.WebControls.Label lblMobilePhone;
protected System.Web.UI.WebControls.Label lblTelephone;
protected System.Web.UI.WebControls.Label lblConsigneeName;
protected System.Web.UI.WebControls.Label lblOrderTime;
protected System.Web.UI.WebControls.Label lblConsigneePost;
protected System.Web.UI.WebControls.Label lblProductPrice;
protected System.Web.UI.WebControls.Label lblProductTotal;
protected System.Web.UI.WebControls.Label lblPostPrice;
protected System.Web.UI.WebControls.Label lblPayment;
protected System.Web.UI.WebControls.Label lblQuantity;
public SqlDataReader dr;
public string store;
public string salesid;
public string buyerid;
public string ordertime;
public string productid;
public string quantity;
public string posttype;
public string postprice;
public string producttotal;
public string payment;
public string consigneename;
public string consigneepost;
public string consigneeadress;
public string telephone;
public string mobilePhone;
public string productprice;
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
SqlConnection connection=new SqlConnection(ConfigurationSettings.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;
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -