Default.aspx.cs

(开头部分) 7KB

这里只显示每个文件的开头 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 _Default : System.Web.UI.Page
{
    Dbhelp dh = new Dbhelp();
    string newid = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        
        if (!IsPostBack)
        {//从数据库中读取各类信息
            Application["UserInfor"] = string.Empty;//将用户登陆信息置空
            GVNews.DataSource = dh.GetData("select top 6 * from News order by NewID desc");//读取最新前六条新闻
            GVNews.DataBind();
            TxtName.Focus();
            GvDonload.DataSource = dh.GetData("select top 5 DName,Id from Download order by Id desc");//读取最新下载资料
            GvDonload.DataBind();
            GvLeague.DataSource = dh.GetData("select top 5 * from League_Table order by ID desc");
            GvLeague.DataBind();
            DataSet ds = dh.GetData("select top 1 Contents from Affiche order by Id desc");
            if(ds.Tables[0].Rows.Count>0)
            LblAd.Text = ds.Tables[0].Rows[0][0].ToString();
            GVActivity.DataSource = dh.GetData("select top 5 Name,Activity,ID from League_Table where IntActivity=1 order by ID desc");
            GVActivity.DataBind();
            ds = dh.GetData("select top 1 Viscera from News order by NewID desc");
            if(ds.Tables[0].Rows.Count>0)
            LblReport.Text = ds.Tables[0].Rows[0][0].ToString();
            DataList1.DataSource = dh.GetData("select * from ShowImage");
            DataList1.DataKeyField = "Id";
            DataList1.DataBind();
            DataList2.DataSource = dh.GetData("select top 6 * from UrlMessege order by Id desc");
            DataList2.DataBind();
        }

    }
    protected void IBtnLogin_Click(object sender, ImageClickEventArgs e)
    {
        string sql = string.Format("select count(*) from StudentLogon where StuID=@Name and StuPwd=@Pwd");
        SqlCommand cmd=new SqlCommand(sql,dh.conn);
        if (dh.conn.State == ConnectionState.Closed)
            dh.conn.Open();
        SqlParameter name = new SqlParameter("@Name",TxtName.Text);
        SqlParameter pwd = new SqlParameter("@Pwd", TxtPwd.Text);
        cmd.Parameters.Add(name);
        cmd.Parameters.Add(pwd);
        int count = (int)cmd.ExecuteScalar();
        if (count == 1)
        {
            LblUserInfor.ForeColor = System.Drawing.Color.Green;
            Application["UserInfor"] = TxtName.Text;
            LblUserInfor.Text = Application["UserInfor"].ToString() + ",您已登录";
后面还有 127 行代码,购买后查看完整代码

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

AI 解读 AI

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

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