日期:2014-05-17 浏览次数:20512 次
public string MessageBox(string txt,string Url) { string str; str = "<script language=javascript>alert('"+txt+"');location='"+Url+"'</script>"; return str; }
protected void Button1_Click(object sender, EventArgs e) { if (i == 1) { if(bc.seleSQL("select count(*) from Usersmr where UserName='"+UserName.Text+"' AND UserPwd='"+UserPwd.Text+"'AND Roled='"+qx+"'")) { Session["loginName"] = UserName.Text; Response.Write(bc.MessageBox("学生登陆成功","../student/Text.aspx")); } else { Response.Write(bc.MessageBox("登录失败,请输入正确的用户名或者密码","Login.aspx")); } } if(i==0) { if(bc.seleSQL("select count(*) from Usersmr where UserName='"+UserName.Text+"' AND UserPwd='"+UserPwd.Text+"'AND Roled='"+qxa+"'")) { Session["loginName"] = UserName.Text; Response.Write(bc.MessageBox("教师登陆成功","../teacher/teacher.aspx")); } else { Response.Write(bc.MessageBox("登录失败,请输入正确的用户名或者密码","Login.aspx")); } } }
using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; public partial class teacher_teacher : System.Web.UI.Page { string a, b; protected void Page_Load(object sender, EventArgs e) { try { a = Session["loginName"].ToString(); //Label1.Text = a; DataBase bc = new DataBase(); Response.Write(bc.MessageBox(a)); //bc.createCon(); //b=bc.getRead("select DepartmentId from Usersmr where UserName='"+a+"'"); //Label2.Text = b; } catch (Exception z) { } } protected void Button1_Click(object sender, EventArgs e) { } }