?? 管理員新增輔導(dǎo)員.aspx.cs
字號:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace 學(xué)生綜合素質(zhì)測評系統(tǒng)
{
/// <summary>
/// 管理員新增輔導(dǎo)員 的摘要說明。
/// </summary>
public class 管理員新增輔導(dǎo)員 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.TextBox TextBox2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.TextBox TextBox3;
protected System.Web.UI.WebControls.Label Label4;
protected System.Web.UI.WebControls.Label Label5;
protected System.Web.UI.WebControls.TextBox TextBox5;
protected System.Web.UI.WebControls.Label Label6;
protected System.Web.UI.WebControls.TextBox TextBox6;
protected System.Web.UI.WebControls.Label Label7;
protected System.Web.UI.WebControls.TextBox TextBox7;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.DropDownList DropDownList1;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.Label Label9;
protected System.Web.UI.WebControls.Label Label11;
protected System.Web.UI.WebControls.HyperLink HyperLink1;
protected System.Web.UI.WebControls.HyperLink HyperLink5;
protected System.Web.UI.WebControls.HyperLink HyperLink2;
protected System.Web.UI.WebControls.HyperLink HyperLink4;
protected System.Web.UI.WebControls.HyperLink HyperLink6;
protected System.Web.UI.WebControls.HyperLink HyperLink7;
protected System.Web.UI.WebControls.Label Label10;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此處放置用戶代碼以初始化頁面
}
#region Web 窗體設(shè)計器生成的代碼
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 該調(diào)用是 ASP.NET Web 窗體設(shè)計器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 設(shè)計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Button2.Click += new System.EventHandler(this.Button2_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
SqlConnection conn=new SqlConnection("Server=.;database=學(xué)生綜合素質(zhì)測評系統(tǒng);user=sa;password=");
conn.Open();
string sql1="select 帳號 from 輔導(dǎo)員 where 帳號='"+TextBox3.Text+"'";
SqlCommand mycom1=new SqlCommand(sql1,conn);
SqlDataReader mydr1=mycom1.ExecuteReader();
if (mydr1.Read()==true)
{
Label9.Text="該帳號已存在!";
}
else
{
SqlConnection Conn1=new SqlConnection("Server=.;database=學(xué)生綜合素質(zhì)測評系統(tǒng);user=sa;password=");
Conn1.Open();
string pp="insert into 輔導(dǎo)員(姓名,學(xué)院編號,帳號,性別,密碼,年級編號,專業(yè)編號) values('"+TextBox1.Text+"','"+TextBox2.Text+"','"+TextBox3.Text+"','"+DropDownList1.SelectedItem.Text+"','"+TextBox5.Text+"','"+TextBox6.Text+"','"+TextBox7.Text+"')";
SqlCommand mycom=new SqlCommand(pp,Conn1);
SqlDataReader mydr=mycom.ExecuteReader();
Label10.Text="操作成功!";
}
}
private void Button2_Click(object sender, System.EventArgs e)
{
TextBox1.Text="";
TextBox2.Text="";
TextBox3.Text="";
TextBox5.Text="";
TextBox6.Text="";
TextBox7.Text="";
RequiredFieldValidator1.Text="";
Label9.Text="";
Label10.Text="";
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -