您目前尚未登陆,请选择【登陆】或【注册
首页->行政办公->库存管理系统V1.0源码>>Login.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:库存管理系统V1.0源码
当前文件:文件类型 StoreManage/Login.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11using System.Data.SqlClient; 12 13public partial class Login : System.Web.UI.Page 14{ 15 private readonly string ConnectionString = ConfigurationManager.AppSettings["ConnectionString"].ToString(); 16 protected void Page_Load(object sender, EventArgs e) 17 { 18 if (!IsPostBack) 19 { 20 Session["Admin"] = this.TextBox1.Text.Trim(); 21 } 22 23 } 24 protected void Button1_Click(object sender, EventArgs e) 25 { 26 //创建连接字符串 27 string sqlstr; 28 sqlstr = "select Pwd from tb_User where UserName=@adminname"; 29 SqlConnection scon=new SqlConnection(ConnectionString); 30 SqlCommand scm= new SqlCommand(sqlstr,scon); 31 scm.Parameters.Add("@adminname",SqlDbType.VarChar,20); 32 scm.Parameters["@adminname"].Value=this.TextBox1.Text.Trim(); 33 scon.Open(); 34 SqlDataReader reader=scm.ExecuteReader(); 35 if (reader.Read()) 36 { 37 38 string strPwd=reader[0].ToString(); 39 40 reader.Close(); 41 if(strPwd!=TextBox2.Text.Trim()) 42 { 43 this.LabelMsg.Text="密码错误!"; 44 } 45 else 46 { 47 Response.Redirect("ManageList.aspx"); 48 } 49 50 } 51 else 52 { 53 this.LabelMsg.Text="对不起,您没有权限!"; 54 scon.Close(); 55 } 56 57 } 58 59 protected void Button2_Click(object sender, EventArgs e) 60 { 61 this.TextBox1.Text = ""; 62 this.TextBox2.Text = ""; 63 } 64}
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:库存管理系统V1.0源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号