var table = SQLiteHelper.Instance.MinuteData;
string sTime = dtpStart.Value.ToString("yyyy-MM-dd HH:mm:ss");
string eTime = dtpEnd.Value.ToString("yyyy-MM-dd HH:mm:ss");
var total = SQLiteHelper.Instance.QueryCount(table, " where Dbtime >= '" + sTime + "' and Dbtime < '" + eTime + "'");
if (total <= 0)
{
MessageBox.Show("无数据");
return;
}
if (total <= 50) page = 1;
var pageIndex = (page - 1) <= 0 ? 0 : page - 1;
string sql = " select * from (select *, ROW_NUMBER() over (order by ID) ROW_ID from " + table + " where Dbtime between
'" + sTime + "' and '" + eTime + "' ) t where t.Dbtime between '" + sTime + "' and '" + eTime + "' AND ROW_ID > " + pageIndex
* 50 + " ORDER BY Dbtime DESC limit 50;";
List<DbData> datas = SQLiteHelper.Instance.Query<DbData>(sql);
var allPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(total) / rows));
C# SQLiteHelper 分页查询
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 第一组: 姚成栋 语言集成查询 LINQ(Language Integrated Query)语言集成查询是一组...
- 框架介绍 依照惯例首先介绍本期主角:ShardingCore[https://github.com/dotnetc...