WebUI/Admin/Yonghu.aspx.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using H.Model;
using H.BLL;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;

public partial class Admin_Yonghu : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {
        Bind();
    }

    protected void Bind()
    {
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["SQLConn"].ToString());
        conn.Open();
        string strsql = " select * from [admin] ";
        SqlCommand cmdd = new SqlCommand(strsql,conn);
        DataSet ds = new DataSet();
        SqlDataAdapter sdr = new SqlDataAdapter(cmdd);
        sdr.Fill(ds);
        GridView1.DataSource = ds;
        GridView1.DataBind();
        conn.Close();
    }

    protected void Del(object sender, CommandEventArgs e)
    {
        int id = Convert.ToInt32(e.CommandArgument.ToString());
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["SQLConn"].ToString());
        conn.Open();
        string strsql = " delete from [admin] where id="+id;
        SqlCommand cmdd = new SqlCommand(strsql, conn);
        cmdd.ExecuteNonQuery();
        Bind();
    }
}

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

AI 解读

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

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