sysadminFloodadd.aspx.cs

(开头部分) 2KB

这里只显示每个文件的开头 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 adminFloodAdd : System.Web.UI.Page
{
    SqlConnection conn;
    SqlCommand cmd;
    SqlDataAdapter sda;
    //SqlDataReader dr;
    DataSet ds;

    protected void Page_Load(object sender, EventArgs e)
    {
        this.Gv_bind();
    }

    private void Gv_bind()
    {
        conn = sqldata.createCon();
        conn.Open();
        string sql1 = "select floodID as 编号,eareName as 区域名,floodName as 楼栋名,floodType as 楼栋类型 from flood inner join eare on eare.eareID=flood.eareID order by floodID";
        sda = new SqlDataAdapter(sql1, conn);
        ds = new DataSet();
        sda.Fill(ds);
        this.GridView1.DataSource = ds;
        this.GridView1.DataBind();
    }

    protected void enter_Click(object sender, EventArgs e)
    {
        conn = sqldata.createCon();
        conn.Open();
        int eareID = Convert.ToInt32(this.DropDownList1.SelectedValue);
        string floodName = this.floodName.Text;
        string floodType = this.DropDownList2.SelectedValue;
        string sql = "insert into flood (floodName,eareID,floodType)values(@floodName,@eareID,@floodType)";
        cmd = new SqlCommand(sql, conn);
        SqlParameter id1 = new SqlParameter("@floodName", SqlDbType.VarChar, 20);
        SqlParameter id2 = new SqlParameter("@eareID", SqlDbType.Int, 4);
        SqlParameter id3 = new SqlParameter("@floodType", SqlDbType.VarChar, 10);
        id1.Value = floodName;
        id2.Value = eareID;
        id3.Value = floodType;
        cmd.Parameters.Add(id1);
        cmd.Parameters.Add(id2);
        cmd.Parameters.Add(id3);
        if (Convert.ToInt32(cmd.ExecuteNonQuery()) > 0)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "info", "alert('添加成功!');", true);
        }
        else
后面还有 16 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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