using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System;
using System.IO;namespace Exmaine.Admins
{
  public SqlDataReader GetUserLogin(String sUserName,String sPassword)
{     //定义数据库Connection and Command
   SqlConnection myConnection=new SqlConnection(SQLHelper.DBCONNECTIONSTRING);
   SqlConnection myCommand=new SqlConnection("Pr_GetUserLogin",myConnection);
      
   //定义访问数据库的方式为存储过程
myConnection.CommandType=CommandType.StoredProcedure;
//创建访问数据库的参数
SqlParameter[]paramCache=SQLHelper.GetCachedParameters(paramGetUserLogin);  if(paramCache=null)
{  ///向存储过程和Cache中添加参数
paramCache=new SqlParameter[]{
           
 new SqlParameter("@UserName",SqlDbType.VarChar),
 new SqlParameter("@Password",SqlDbType.VarChar)};
          
SQLHelper.CacheParameters(paramGetUserLogin,paramCache);
   
            } SQLHepler.AddMyCommandParams(myCommand,paramCache); paramCache[0].Value=sUserName;paramCache[1].Value=sPassword;
SqlDataReader dr=null;
//打开数据库的连接
try{myConnection.open();}
catch(Exception ex){throw new MyException("10001","数据库连接失败 !",ex);}

 
//执行数据库的存储过程(访问数据库)
try{dr=myCommand.ExecuteReader(CommandBehavior.CloseConnection);}
catch(Exception ex){throw new MyException("10002",ex.Message,ex);}
return dr;            //返回dr }
}