asp.net中检查用户是否过期的代码

 SqlParameter[] parms ={
            db.MakeInParam("@name",SqlDbType.VarChar,50,name),
            db.MakeInParam("@pass",SqlDbType.VarChar,50,pass),
            };

            StringBuilder sbf = new StringBuilder();
            sbf.Append(" select datediff(day,(select datetime from UserInfo where ID=1),getdate()) as day from UserInfo ");
            sbf.Append(" where name=@name");
            sbf.Append(" and pass=@pass");
         
            DataSet ds= db.RunProcReturn(sbf, parms,"User");
            int i =Int32.Parse( ds.Tables[0].Rows[0]["day"].ToString())  ;
            if (i > 0)
            {
                return true;
            }
            else
            {
                return false;
            }

转载于:https://www.cnblogs.com/QiuJL/archive/2011/08/08/4524303.html

你可能感兴趣的:(asp.net中检查用户是否过期的代码)