Asp.net源码专业站
首页->商务办公->Asp.net考勤系统源码>>admin.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:Asp.net考勤系统源码
当前文件:文件类型 kaoqin/admin.aspx.cs[2K,2009-6-12 11:46:24]打开代码结构图
普通视图
		            
1using System; 2using System.Collections; 3using System.ComponentModel; 4using System.Data; 5using System.Drawing; 6using System.Web; 7using System.Web.SessionState; 8using System.Web.UI; 9using System.Web.UI.WebControls; 10using System.Web.UI.HtmlControls; 11using System.Data.OleDb; 12 13namespace KaoQin 14{ 15 /// <summary> 16 /// WebForm1 的摘要说明。 17 /// </summary> 18 public class WebForm1 : System.Web.UI.Page 19 { 20 protected System.Web.UI.WebControls.Label labId; 21 protected System.Web.UI.WebControls.Label labPwd; 22 protected System.Web.UI.WebControls.TextBox txtPwd; 23 protected System.Web.UI.WebControls.Button btnOk; 24 protected System.Web.UI.WebControls.Button btnCanle; 25 protected System.Web.UI.WebControls.TextBox txtId; 26 protected System.Data.OleDb.OleDbCommand com; 27 protected System.Web.UI.WebControls.Label info; 28 protected System.Data.OleDb.OleDbDataReader reader; 29 protected System.Data.OleDb.OleDbConnection con; 30 protected System.Data.OleDb.OleDbDataAdapter da; 31 protected System.Data.DataSet ds; 32 33 private void Page_Load(object sender, System.EventArgs e) 34 { 35 // 在此处放置用户代码以初始化页面 36 string strcon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("message.mdb")+";User Id=admin;Password=;"; 37 con=new OleDbConnection(strcon); 38 } 39 40 Web 窗体设计器生成的代码 62 63 private void btnOk_Click(object sender, System.EventArgs e) 64 { 65 string id,strSql,strSql1; 66 int count=0,count1=0; 67 id=txtId.Text; 68 strSql="select * from admin where adminId='"+id+"'"; 69 con.Open(); 70 com=new System.Data.OleDb.OleDbCommand(strSql,con); 71 reader=com.ExecuteReader(); 72 while(reader.Read()) 73 { 74 count++; 75 } 76 reader.Close(); 77 com.Dispose(); 78 con.Close(); 79 if(count==0) 80 { 81 info.Text="该管理员不存在!"; 82 } 83 else 84 { 85 strSql1="select adminPwd from admin where adminId='"+id+"' and adminPwd='"+txtPwd.Text.ToString().Trim()+"'"; 86 con.Open(); 87 com=new System.Data.OleDb.OleDbCommand(strSql1,con); 88 reader=com.ExecuteReader(); 89 while(reader.Read()) 90 { 91 count1++; 92 } 93 reader.Close(); 94 com.Dispose(); 95 con.Close(); 96 if(count1==0) 97 { 98 info.Text="管理员密码错误!"; 99 } 100 else 101 { 102 info.Text=""; 103 Session["admin"]=txtId.Text; 104 Response.Redirect("one.aspx"); 105 } 106 } 107 con.Close(); 108 } 109 110 private void btnCanle_Click(object sender, System.EventArgs e) 111 { 112 txtId.Text=""; 113 txtPwd.Text=""; 114 } 115 } 116} 117
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:Asp.net考勤系统源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146