Default.aspx.cs

(开头部分) 5KB

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

using System;
using System.Data;
using System.Configuration;
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 _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

        DataSet ds=databaseAccess.GetDataSet("select top 6 product.originalprice,product.saleprice,product.photo,productID from product order by publishyear,publishmonth desc ");
       this.DataList1.DataSource = ds.Tables[0].DefaultView;
       this.DataList1.DataBind();
       ds = databaseAccess.GetDataSet("select originalprice,saleprice,photo,productID from product where productID in (select top 6 productID  from shoppingcart group by productID  order by sum(productquantity) desc)");
       this.DataList2.DataSource = ds.Tables[0].DefaultView;
        this.DataList2.DataBind();                     
        if (!IsPostBack)
        {
            SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["shopConnectionString"].ToString());
            cn.Open();
            SqlCommand cmd = new SqlCommand("select * from category", cn);
            SqlDataReader read = cmd.ExecuteReader();
            this.DropDownList1.DataSource = read;
            this.DropDownList1.DataTextField = "categoryname";
            this.DropDownList1.DataValueField = "categoryID";
            this.DropDownList1.DataBind();
            read.Close();
            cn.Close();
            
            string id = this.DropDownList1.SelectedValue;
            cn = new SqlConnection(ConfigurationManager.ConnectionStrings["shopConnectionString"].ToString());
            cn.Open();
            cmd = new SqlCommand("select * from product where categoryID='" + id + "'", cn);
            read = cmd.ExecuteReader();
            this.DropDownList2.DataSource = read;
            this.DropDownList2.DataTextField = "productname";
            this.DropDownList2.DataValueField = "productID";
            this.DropDownList2.DataBind();
            read.Close();
            cn.Close();     
        }    
    }
    protected void register_Click(object sender, EventArgs e)
    {
        Response.Redirect("register.aspx");
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["shopConnectionString"].ToString());
        cn.Open();
        SqlCommand cmd = new SqlCommand("select * from shopper", cn);
        SqlDataReader read = cmd.ExecuteReader();
        while (read.Read())
        {
后面还有 63 行代码,购买后查看完整代码

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

AI 解读 AI

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

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