Example #1
0
        public static DataTable VisitByHour(long NewsID)
        {
            DataTable _result = null;

            using (LogMainDB db = new LogMainDB()) {
                _result = db.SelectQuery(string.Format("select count(VisitHour) AS Visit, VisitHour FROM(select DATEPART(hour, VisitDate) AS VisitHour from VisitorInfor where NewsID = {0}) AS A GROUP BY VisitHour ORDER BY VisitHour ", NewsID));
            }

            return(_result);
        }
Example #2
0
        public static DataTable VisitByHourV2(long NewsID)
        {
            DataTable _result = null;

            using (LogMainDB db = new LogMainDB())
            {
                _result = db.SelectQuery(string.Format("select sum(PageView) Visit, dateadd(hour,[hour],[date]) [VisitHour] from Article_Hourly where Article_ID = {0} and dateadd(hour,[hour],[date]) > DATEADD(hour, -24, getdate()) group by dateadd(hour,[hour],[date])", NewsID));
            }

            return(_result);
        }