OATest/UserWork/MailSend.aspx.cs

(开头部分) 4KB

这里只显示每个文件的开头 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 UserWork_MailSend : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
   {
       if (!IsPostBack)
       {
           SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);
           con.Open();
           string sql = "select * from Branch";
           SqlCommand com = new SqlCommand(sql,con);
           SqlDataReader dr = com.ExecuteReader();
           while (dr.Read())
           {
               DropDownList1.Items.Add(new ListItem(dr["Branch"].ToString(), dr["Dutyid"].ToString()));
           }
           DropDownList1.Items.Insert(0,"选择部门....");
            
           con.Close();



           SqlConnection con1 = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);
           con1.Open();
           string sql1 = "select * from Employee";
           SqlDataAdapter da1 = new SqlDataAdapter(sql1, con1);
           DataSet ds1 = new DataSet();
           da1.Fill(ds1);
           ListBox1.DataSource = ds1;
           ListBox1.DataTextField = "Name";
           ListBox1.DataValueField = "username";
           ListBox1.DataBind();
           con1.Close();
       }

    }
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        string Dutyid = DropDownList1.SelectedItem.Value.ToString();
            SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);
            con.Open();
            string sql = "select Name,username from Employee  where dutyid="+Dutyid+"";
            SqlDataAdapter da = new SqlDataAdapter(sql, con);
            DataSet ds = new DataSet();
            da.Fill(ds);
            ListBox1.DataSource = ds;
            ListBox1.DataTextField = "Name";
            ListBox1.DataValueField = "username";
            ListBox1.DataBind();
            con.Close();
后面还有 87 行代码,解锁后查看完整代码

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

AI 解读

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

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