EquipmentManagement/Admin/Add_EquipmentInfo.aspx.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
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 Data_Control;
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
     

        
        if (!IsPostBack)
        {
            AddEquiDB addEquiDB = new AddEquiDB();
            string sqlstr = "select DepartmentID from dbo.Department";
            DataSet ds = addEquiDB.GetDepartmentInfo(sqlstr);
            int total = ds.Tables[0].Rows.Count;
            for (int i = 0; i < total; i++)
            { DepartmentID.Items.Add(ds.Tables[0].Rows[i][0].ToString()); }
            string[] strsql;
            strsql = new string[2];
            strsql[0] = "select EquiStyleID as bm,EquiStyleName as nr from EquiStyle";
            strsql[1] = "select EquiSortID as bm,EquiSortName as nr from EquiSort";
            DropDownList[] ddl;
            ddl = new DropDownList[2];
            ddl[0] = DDL_Sbzl;
            ddl[1] = DDL_Sblb;
            for (int i = 0; i <= 1; i++)
            { DDL_BindData(strsql[i], ddl[i]); }
        }
    }
    //绑定数据
    private void DDL_BindData(string strSQL, DropDownList DDL)
    {
        AddEquiDB addEquiDB = new AddEquiDB();
        SqlConnection conn=new SqlConnection() ;
        conn = addEquiDB.GetConn();
        conn.Open();
        SqlCommand cmd=new SqlCommand ();
        cmd.Connection =conn;
        cmd.CommandText =strSQL ;
        DDL.DataSource = cmd.ExecuteReader();
        DDL.DataTextField = "nr";
        DDL.DataValueField = "bm";
        DDL.DataBind();
        DDL.Items.Insert(0, new ListItem("全部", ""));
        conn.Close();
    }
    protected void DDL_Sblb_SelectedIndexChanged(object sender, EventArgs e)
    {
        string sblb_my = DDL_Sblb.SelectedValue;
        if (sblb_my != "")
后面还有 68 行代码,购买后查看完整代码

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

AI 解读 AI

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

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