chakan.aspx.cs

(开头部分) 3KB

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

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 chakan : System.Web.UI.Page
{
    string id;        //product 中对应的id
    string styleno1;

    protected void Page_Load(object sender, EventArgs e)
    {
        id = this.Request["id"].ToString();
        if (!IsPostBack)
        {

            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["sq_chaletshopConnectionString"].ToString());//数据库使用Northwind;
            conn.Open();
            string strSql = "select product.id,styleno,nprice,wprice,big_name,description,productpic,sales_amount from product,category_up where product.category_up_id=category_up.id and product.id='" + id + "'";
            SqlCommand sqlcomm = new SqlCommand(strSql, conn);
            SqlDataReader sdr = sqlcomm.ExecuteReader();
            sdr.Read();
            this.name.Text = sdr["styleno"].ToString();
            this.nprice.Text = sdr["nprice"].ToString();
            this.wprice.Text = sdr["wprice"].ToString();
            this.category_up.Text = sdr["big_name"].ToString();
            this.description.Text = sdr["description"].ToString();
            this.productpic.ImageUrl = sdr["productpic"].ToString();
            this.sales_amount.Text = sdr["sales_amount"].ToString();
            if (Convert.IsDBNull(sdr["productpic"]))
            {
                this.productpic.ImageUrl = "~images/no.gif";
            }
            sdr.Dispose();
            sqlcomm.Dispose();

            string strqry = "";//定义sql语句变量
            strqry = "select * From Comment where Comment_ProductID=" + id + " order by CommentId desc";//查询所有的文章

            //绑定数据


            SqlCommand sqlcomm1 = new SqlCommand(strqry, conn);
            SqlDataAdapter da = new SqlDataAdapter(sqlcomm1);
            DataSet ds = new DataSet();
            da.Fill(ds, "a");

            DataView dvlist = ds.Tables[0].DefaultView;  //获取的数据存到DataView         
            AspNetPager1.RecordCount = dvlist.Table.Rows.Count;//记录数
            Session["dvlist"] = dvlist;//数据存储到session里
            bindData();

            conn.Dispose();
后面还有 21 行代码,购买后查看完整代码

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

AI 解读 AI

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

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