Default.aspx.cs

(完整代码) 1KB

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;

public partial class Default : System.Web.UI.Page
{
    public string npics, nlinks, ntexts;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataSet ds = DBHelper.GetDataSet("select top 10 * from TB_XinWen order by ID");//从tb_xinwen表里按id选取前10个记录进行升序排序
            this.GridView1.DataSource = ds.Tables[0];
            this.GridView1.DataBind();
            getsyt();


            DataSet ds1 = DBHelper.GetDataSet("select  top 8  * from TB_Member order by RegisterDate desc");//按注册日期对前8个记录进行降序排序
            this.DataList1.DataSource = ds1.Tables[0];
            this.DataList1.DataBind();
        }
    }

    private void getsyt()
    {
        string sql = "  select top 5 * from  TB_AnLi";
        DataSet result = new DataSet();
        result = DBHelper.GetDataSet(sql);
        if (result != null)
        {
            if (result.Tables[0].Rows.Count > 0)
            {
                int i = 0;
                for (i = 0; i < result.Tables[0].Rows.Count; i++)
                {
                    npics = npics + result.Tables[0].Rows[i]["PIC"].ToString().Trim() + "|";
                    nlinks = nlinks + "AnLiDetial.aspx?ID=" + result.Tables[0].Rows[i]["ID"].ToString().Trim() + "|";
                    ntexts = ntexts + result.Tables[0].Rows[i]["Title"].ToString().Trim() + "|";

                }

            }
        }
    }
}

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

AI 解读 AI

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

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