detail.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;
using System.Data.SqlClient;
using System.Collections;
namespace 电子商务
{
    public partial class detail : System.Web.UI.Page
    {
        SQLHelper db = new SQLHelper();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bind();
            }
        }
        //定义绑定函数
        public void bind()
        {
            int id = Convert.ToInt32(Request.QueryString["id"].ToString());
            string sql = "select * from product where pro_id=" + id;
            DataTable dt = db.ExecuteQuery(sql, CommandType.Text);
            this.Image1.ImageUrl = dt.Rows[0]["pic"].ToString();
            this.lb_cz.Text = dt.Rows[0]["cz"].ToString();
            this.lb_fg.Text = dt.Rows[0]["fg"].ToString();
            this.lb_name.Text = dt.Rows[0]["name"].ToString();
            this.lb_ms.Text = dt.Rows[0]["ms"].ToString();
            this.lb_price.Text = dt.Rows[0]["price"].ToString();
            //

        }

        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            //
            int id = Convert.ToInt32(Request.QueryString["id"].ToString());
            //得到书的信息
            string sql = "select * from product where pro_id=" + id;
            DataTable dt = db.ExecuteQuery(sql, CommandType.Text);

            //
            if (Session["zh"] == null)
            {
                Response.Write("<script lanuage=javascript>alert('请登陆后再进行购买');location='index.aspx'</script>");
            }
            else//假如登陆后就放入购物车中
            {


                if (Session["ShopCart"] == null)
                {
                    //如果用户没有分配购物车
                    Hashtable hashCar = new Hashtable();         //新生成一个
                    hashCar.Add(id, 1); //添加一个商品
                    Session["ShopCart"] = hashCar;     //分配给用户
后面还有 38 行代码,购买后查看完整代码

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

AI 解读 AI

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

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