/// <summary> /// 通过时间段来查询数据总数 /// </summary> /// <param name="startTime">开始时间</param> /// <param name="endTime">结束时间</param> /// <returns></returns> public int selectMsg(DateTime startTime, DateTime endTime) { string sql = "select count(*) from BookMsg where BookTime between @startTime and @endTime"; SqlParameter[] pars = { new SqlParameter("@startTime", startTime), new SqlParameter("@endTime", endTime), }; return(Convert.ToInt32(SqlHelp.ExecuteScalare(sql, CommandType.Text, pars))); }
/// <summary> /// 获取总页数数据 /// </summary> /// <returns></returns> public int GetRecordCount() { string sql = "select count(*) from BookMsg"; return(Convert.ToInt32(SqlHelp.ExecuteScalare(sql, CommandType.Text))); }