Logins.cs
资源名称:yjal.rar [点击查看]
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:2k
源码类别:
Email客户端
开发平台:
Visual C++
- /********************************************************************************
- ** 作者:ebDoing
- ** 创始时间: 2008-10-22
- ** 描述:
- ** 主要用于检测用户是否注册用户,…
- ** 表:
- *********************************************************************************/
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Configuration;
- using System.Data.SqlClient;
- namespace User
- {
- public class Logins
- {
- SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["CartConnectionString"].ConnectionString);
- /// <summary>
- ///
- /// </summary>
- /// <param name="name"></param>
- /// <param name="pass"></param>
- /// <returns></returns>
- public bool loginuser(String name,String pass)
- {
- String T_name = name;
- String T_pass = pass;
- String sql = "select * from U_Info where UserName='" + T_name + "' and Password='"+T_pass+"'";
- SqlCommand cmd = new SqlCommand(sql, conn);
- try
- {
- conn.Open();
- SqlDataReader MyReader = cmd.ExecuteReader();
- if (MyReader.Read())
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- catch (Exception ex)
- {
- throw (ex);
- }
- finally
- {
- conn.Close();
- }
- }
- }
- }