最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
ASP.NET简单整理收藏(1)
时间:2008-01-12 编辑:简简单单 来源:一聚教程网
//连接数据库:
//登录
string connstr=System.Configuration.ConfigurationSettings.AppSettings["sqllink"];
SqlConnection conn=new SqlConnection(connstr);
conn.Open();
string sql="select count(*) as icount from sysoper where logname='"+this.usrname.Text+"'";
SqlCommand comm=new SqlCommand(sql,conn);
SqlDataReader dr1=comm.ExecuteReader();
dr1.Read();
string count=dr1["icount"].ToString();
dr1.Close();
if(count!="0")
{
sql="select * from sys where logname='"+this.usrname.Text+"'";
SqlCommand comm1=new SqlCommand(sql,conn);
SqlDataReader dr=comm1.ExecuteReader();
dr.Read();
string drpwd=dr["logpass"].ToString();
dr.Close();
if(drpwd==this.usrpwd.Text)
{
this.Session["logid"]=this.usrname.Text.Trim();
if(dr["PLCName"].ToString()=="")
{
this.Session["level"]="1";
}
if(dr["PLCName"].ToString()!="")
{
this.Session["level"]="2";
this.Session["plcname"]=dr["PLCName"].ToString();
}
this.Response.Redirect("main.aspx");
}
相关文章
- asp.net简单性能计数器---老赵版改良 07-06
- asp.net中操作符简单介绍 02-03
- asp.net sitemap简单使用详解 02-11
- asp.net控件开发(二)-简单属性 06-03
- asp.net简单的计数器 02-29
- 一个简单的ASP.NET Forms 身份认证 01-18