Asp.net源码专业站
首页->新知实践->Ajax之用户注册实例源码>>App-Code/logon.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:Ajax之用户注册实例源码
当前文件:文件类型 AjaxCheckUser/App_Code/logon.cs[2K,2009-6-12 11:31:35]打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Web; 5using System.Web.Security; 6using System.Web.UI; 7using System.Web.UI.WebControls; 8using System.Web.UI.WebControls.WebParts; 9using System.Web.UI.HtmlControls; 10using System.Data.SqlClient; 11//该源码下载自www.51aspx.com(51aspx.com) 12 13/// <summary> 14/// logon 的摘要说明 15/// </summary> 16public class logon 17{ 18 SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["dbuser"].ConnectionString); 19 public logon() 20 { 21 // 22 // TODO: 在此处添加构造函数逻辑 23 // 24 } 25 public bool chklogon(string uername, string password) 26 { 27 // string name = uername; 28 // string pwd = password; 29 // String str = "select top 1 password from info where username='"+name+"'"; 30 // SqlCommand cmd = new SqlCommand(str, con); 31 // try 32 // { 33 // con.Open(); 34 35 // SqlDataReader resu = cmd.ExecuteReader(); 36 37 // if (resu.Read()) 38 // { 39 // if (resu.GetValue(0).ToString() == pwd) 40 // { 41 // return true; 42 // } 43 // else 44 // { 45 // return false; 46 // } 47 // } 48 //51-A-s-p-x.com 49 // } 50 // catch (Exception ex) 51 // { 52 // throw (ex); 53 // } 54 // finally 55 // { 56 // con.Close(); 57 // } 58 59 // return false; 60 // //if(name.Equals(str)) 61 String T_name = uername; 62 63 String T_pass = password; 64 65 String sql = "select * from info where UserName='" + T_name + "' and Password='" + T_pass + "'"; 66 67 SqlCommand cmd = new SqlCommand(sql, con); 68 69 try 70 { 71 con.Open(); 72 73 SqlDataReader da = cmd.ExecuteReader(); 74 75 if (da.Read()) 76 { 77 return true; 78 } 79 else 80 { 81 return false; 82 } 83 } 84 catch (Exception ex) 85 { 86 throw (ex); 87 } 88 finally 89 { 90 con.Close(); 91 } 92 } 93} 94
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:Ajax之用户注册实例源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146