一、学生注册:
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.OleDb; using mydb; public partial class manager_erroll_student : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (Session["Manager"] == null) Response.Write("
"); } protected void Submit1_ServerClick(object sender, EventArgs e) { String filepath = "~/Src/"; String savepath = Server.MapPath("..") + @"\Src\"; int filelength; String filetype; if (FileUpload1.HasFile) { filepath += this.FileUpload1.FileName; String filename = FileUpload1.FileName; savepath += filename; FileUpload1.SaveAs(savepath); filelength = FileUpload1.PostedFile.ContentLength / 1024; filetype = FileUpload1.PostedFile.ContentType; Label2.Text = "
xml:namespace prefix = font style='font-size />
成功上传: " + filename + "
" + "
文件大小:" + filelength + "K
" + "
文件类型:" + filetype; } String userName = this.name.Text; String userID = this.xh.Text; String userSex = "";
if (this.RadioButton1.Checked) userSex += this.RadioButton1.Text; if (this.RadioButton2.Checked) userSex += this.RadioButton2.Text; String E_mail = this.yx.Value; String userPass = this.queding.Text; String BeiZhu = this.ps.Text; String Photo = filepath; String Sdept = this.zy.Text; String Grade = this.nj.Text; //-----------------------------------------------------------------// String sql = "insert into [users] values('" + userID + " ', '" +userPass + " ') "; Class1 cc2 = new Class1(); cc2.dboperation(sql); cc2.close(); String sql1 = "insert into userinf(userID,userName,userSex,BeiZhu,E_mail,Photo,Grade, Sdept) values('" + userID + " ', '" + userName + " ','" + userSex + " ','" + BeiZhu + " ','" + E_mail + "','" + filepath + "','" + Grade + " ','" + Sdept + " ') "; Class1 cc3 =new Class1(); cc3.dboperation(sql1); cc3.close(); String sql3 = "update [userinf] set Photo= '" + filepath + "' where userID= '" + userID + "'"; Class1 cc1 = new Class1(); cc1.dboperation(sql3); cc1.close(); String sql2 = "select * from [users] where userID='" + userID + " '"; Class1 cc4 = new Class1(); if (cc4.select(
sql2).HasRows) { Label1.Text += "
alert('注册失败请重新注册!!');"); } Label1.Text += "欢迎您:" + name.Text + "
"; Label1.Text += "您的:" + xh.Text + "
"; if (RadioButton1.Checked) style='font-size: 14px;font-weight: bold;color:red '>已经 注册成功:" + "
" + "
0 color='blue'>";
Label1.Text += "
性别:" + RadioButton1.Text + "
"; if (RadioButton2.Checked) Label1.Text += "
性别:" + RadioButton2.Text + "
"; Label1.Text += "
您的邮箱:" + yx.Value + "
"; Label1.Text += "
您的个人说明: " + ps.Tex