CmsWeb/html/environment.aspx.cs

(完整代码) 2KB

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;

public partial class html_environment_ : System.Web.UI.Page
{
    public DataSet ds;
    public SqlDataAdapter dr;
    Cms.BLL.C_article bllarticle = new Cms.BLL.C_article();
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
        {
            int classid = Convert.ToInt32(this.Request.QueryString["classid"] ?? "0");//栏目ID
            bind_SeoInfo(classid);//绑定标题、关键词、描述

            RepeaterDataBind();

        }
    }
    #region 绑定标题、关键词、描述
    //绑定标题、关键词、描述
    public void bind_SeoInfo(int classid)
    {
        Cms.BLL.C_Column bllcolumn = new Cms.BLL.C_Column();
        DataSet ds = bllcolumn.GetList("classid=" + classid);
        if (ds.Tables[0].Rows.Count > 0)
        {
            DataRow dr = ds.Tables[0].Rows[0];
            Application["title"] = dr["seoTitle"].ToString();
            Application["Keywords"] = dr["seoKeyword"].ToString();
            Application["Descriptions"] = dr["seoDescription"].ToString();
            Application["classname"] = dr["classname"].ToString();
        }
    }
    #endregion

    #region 数据读取===================================================
    public void RepeaterDataBind()
    {
        int classid = Convert.ToInt32(this.Request.QueryString["classid"] ?? "0");//栏目ID
        string workname = new Cms.BLL.C_Column().GetModel(classid).name.ToString();
        DataSet ds = Cms.DBUtility.DbHelperSQL.Query("SELECT * FROM ( SELECT ROW_NUMBER() OVER (order by T.orderNumber desc )AS Row, T.*  from view_channel_" + workname + " T WHERE parentId=" + classid + "  ) TT WHERE TT.Row between 0 and 8");
        if (ds.Tables[0].Rows.Count > 0 && ds != null)
        {
            this.RepeaterNewlist.DataSource = ds.Tables[0].DefaultView;
            this.RepeaterNewlist.DataBind();
        }
    }
    #endregion
}

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

AI 解读

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

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