product.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;
namespace 电子商务
{
    public partial class product : System.Web.UI.Page
    {
        SQLHelper db = new SQLHelper();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bind();
            }
        }
        //
        //截取字符串
        public string str_len(string str, int len)
        {
            int len1 = str.ToString().Length;

            if (len1 >= len)
            {
                str = str.Substring(0, len);
            }

            return str;

        }
        //
        public void bind()
        {
            int CurrentPage = Convert.ToInt32(this.lbt_now.Text);

            //判断是否有传来参数

            string sql = "";
            if (Request.QueryString["c_id"] == null)
            {
                sql = "select * from product order by pro_id desc";
            }
            else
            {
                int c_id = int.Parse(Request.QueryString["c_id"].ToString());
                sql = "select * from product where c_id=" + c_id + "";
            }
            //

            DataTable dt = db.ExecuteQuery(sql, CommandType.Text);
            PagedDataSource ps = new PagedDataSource();//生成PagedDataSource的实例
            ps.DataSource = dt.DefaultView;
            ps.AllowPaging = true; //是否可以分页
            ps.PageSize = 9; //显示的数量
            ps.CurrentPageIndex = CurrentPage - 1; //取得当前页的页码
            this.lbt_first.Enabled = true;
后面还有 44 行代码,购买后查看完整代码

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

AI 解读 AI

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

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