📄 class_zhuanjia.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 free
{
/// <summary>
/// Summary description for class_zhuanjia.
/// </summary>
public class class_zhuanjia : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox xingming;
protected System.Web.UI.WebControls.TextBox email;
protected System.Web.UI.WebControls.DropDownList xueli;
protected System.Web.UI.WebControls.DropDownList zhicheng;
protected System.Web.UI.WebControls.TextBox jianli;
protected System.Web.UI.HtmlControls.HtmlInputButton Submit1;
protected System.Web.UI.WebControls.RadioButtonList xingbie;
protected System.Data.SqlClient.SqlConnection myconn;
protected System.Web.UI.WebControls.Label tishi;
protected System.Web.UI.WebControls.Button Button1;
protected System.Data.SqlClient.SqlCommand mycomm;
private void Page_Load(object sender, System.EventArgs e)
{
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Submit1.ServerClick += new System.EventHandler(this.Submit1_ServerClick);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Submit1_ServerClick(object sender, System.EventArgs e)
{
try
{
if(Session["free_quanxian"].ToString()!="0")
{
Response.Write("<script>alert('您无权使用!!')</script>");
Response.Redirect("../admin/default.aspx");
}
}
catch
{
Response.Write("<script>alert('您无权使用!!')</script>");
Response.Redirect("../admin/default.aspx");
}
myconn=new SqlConnection(Session["str_connection"].ToString());
myconn.Open();
string sqlstr="select * from class_zhuanjia where xingming='"+xingming.Text.Trim()+"'";
mycomm=new SqlCommand(sqlstr,myconn);
SqlDataReader mydr;
mydr=mycomm.ExecuteReader();
if (mydr.Read())
{
//Label1.Text="该用户已经存在,请重新输入!";
tishi.Text="该专家已经注册,请重新输入!";
mydr.Close();
myconn.Close();
return ;
}
else if(Page.IsValid)
{
mydr.Close();
sqlstr="Insert into class_zhuanjia(xingming,xingbie,zhicheng,xueli,jianli,email) values('"+xingming.Text.Trim()+"','"+xingbie.SelectedValue.Trim()+"','"+zhicheng.SelectedValue.Trim()+"','"+xueli.SelectedValue.Trim()+"','"+jianli.Text.Trim()+"','"+email.Text.Trim()+"')";
mycomm=new SqlCommand(sqlstr,myconn);
if(mycomm.ExecuteNonQuery()>0)
{
tishi.Text="专家注册成功!";
}
else
{
tishi.Text="操作有误";
}
}
}
private void Button1_Click(object sender, System.EventArgs e)
{
tishi.Text="";
xingming.Text="";
xingbie.Items[0].Selected=true;
zhicheng.Items[0].Selected=true;
xueli.Items[0].Selected=true;
jianli.Text="";
email.Text="";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -