日期:2014-05-17 浏览次数:21269 次
public User Login(string UserName, string Password)
{
string sql = string.Format("select top 1 Id,UserName,Password,ImageHead,IPAddress,Signature from Tab_Users where UserName=@UserName and Password=@Password", UserName, Password);
using (DataTable dt = DBHelper.ExecDataTable(sql, CommandType.Text, null))
{
if (dt.Rows.Count > 0)
{
DataRow dr = dt.Rows[0];
User u = new User()
{
Id = Convert.ToInt32(dr["Id"]),
UserName = dr["UserName"].ToString(),
Password = dr["Password"].ToString(),
IPAddress = dr["IPAddress"].ToString(),
Signature = dr["Signature"].ToString(),
ImageHead = (byte[])dr["ImageHead"]
};
return u;
}
}
return null;
}