public bool checkTime(string sessID)
{
//如果是超过了20分钟就返回false;
//实例化数据库联接字符串
ETC.SQLHelper.ConnString = System.Configuration.ConfigurationManager.ConnectionStrings["etcConnString"].ToString();
//如果是超过了20分钟
DataSet ds = ETC.SQLHelper.GetDataSet("SELECT ID FROM LoginInfo WHERE SessionID='" + sessID + "'"
+" AND DATEDIFF(minute,LastVisitTime,getdate())>20");
if (ds != null && ds.Tables[0].Rows.Count != 0)
{
return false;
}
else
{
if(ETC.SQLHelper.ExecuteQuery("UPDATE LoginInfo SET LastVisitTime=getdate() WHERE SessionID='"+sessID+"'"))
{
return true;
}
else
{
return false;
}
}
}
{
//如果是超过了20分钟就返回false;
//实例化数据库联接字符串
ETC.SQLHelper.ConnString = System.Configuration.ConfigurationManager.ConnectionStrings["etcConnString"].ToString();
//如果是超过了20分钟
DataSet ds = ETC.SQLHelper.GetDataSet("SELECT ID FROM LoginInfo WHERE SessionID='" + sessID + "'"
+" AND DATEDIFF(minute,LastVisitTime,getdate())>20");
if (ds != null && ds.Tables[0].Rows.Count != 0)
{
return false;
}
else
{
if(ETC.SQLHelper.ExecuteQuery("UPDATE LoginInfo SET LastVisitTime=getdate() WHERE SessionID='"+sessID+"'"))
{
return true;
}
else
{
return false;
}
}
}