Sep232010
跳转系统的条件日志查询功能开发完成了
每次看到跳转系统中的日志,都想看看今天、昨天、本周等的具体记录情况。老版本中没有加入此项功能,今天,闲得没事做,就给跳转系统增加了此项功能。
弄完了这些,其实就是数据源的一个SQL语句的不同。
贴上跳转系统中的那些SQL语句吧:
switch (Request.QueryString["Range"].ToLower()) { case "today": ShowUserRangeLogs.SelectCommand = "SELECT * FROM [Table] WHERE CONVERT(varchar(8),[VisitTime],112)=CONVERT(varchar(8),GetDate(),112)"; break; case "yesterday": ShowUserRangeLogs.SelectCommand = "SELECT * FROM [Table] WHERE DATEDIFF(dd,cast([VisitTime] as datetime),GETDATE()) = 1"; break; case "thisweek": ShowUserRangeLogs.SelectCommand = "SELECT * FROM [Table] WHERE DATEDIFF(week,[VisitTime],GETDATE())=0"; break; case "thismonth": ShowUserRangeLogs.SelectCommand = "SELECT * FROM [Table] WHERE DATEDIFF(mm,[VisitTime],GETDATE())=0"; break; case "thisyear": ShowUserRangeLogs.SelectCommand = "SELECT * FROM [Table] WHERE DATEDIFF(yy, [VisitTime], GETDATE()) = 0"; break; default: break; }