OrderInfo.aspx.cs
(完整代码) 1KBusing 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;
public partial class OrderInfo : System.Web.UI.Page
{
string str = System.Configuration.ConfigurationManager.AppSettings["str_con"].ToString(); //连接数据库
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 * from [dbo].[OrderInfo] where UserName='" + Session["login"] + "'";
con.Open();
SqlDataAdapter dr = new SqlDataAdapter(str_cmd, con);
cmd = new SqlCommand(str_cmd, con);
if (cmd.ExecuteScalar() != null)
{
SqlDataReader read = cmd.ExecuteReader();
read.Read();
label.Font.Size = 18; /*Label字体大小*/
label2.Font.Size = 18; /*Label字体大小*/
label2.Text = "订单编号: "+read["订单ID"].ToString();
label.Text = "下单时间: "+read["订购日期"].ToString();
read.Close();
}
DataSet ds = new DataSet();
dr.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。