复制代码代码如下所示:

功能的(表,在那里,秩序,ordersort,curpage,PageSize,minijson)

作者:牛

使用方法:响应。写的(表表名,在条件为主键(必要的),OrderSort(升序、降序),curpage当前页,每页数页大小,如果MiniJson出口PageSize格式。

'

朦胧的我,J,RS

如果ordersort = 然后ordersort =ASC

如果,那么在哪里

集= server.createobject(ADODB。记录集)

如果curpage > 1

tmpsql =选择A *(选择上(curpage)*为* ,表在秩序的秩序ordersort 左(选择)连接上(curpage-1)*为* ,表按,ordersort )B A.秩序=秩序,B法(B命令'0'、'1',= 1)

其他的

tmpsql =选择A *(选择顶)*为*表,,

最后如果

如果pageSize = 0然后tmpsql =SELECT * FROM表

Rs.open TmpSql,Conn,1

RealSize = rs.recordcount

我rs.recordcount-1 = 0

tmpjson = tmpjson{

J = 0 rs.fields.count-1

tmpjson = tmpjson (Rs.fields(J)。名字)

tmpjson = tmpjson RS(J)

如果J < rs.fields.count-1然后tmpjson = tmpjson

下一个

tmpjson = tmpjson}

如果我有rs.recordcount-1然后tmpjson = tmpjson

tmpjson = tmpjson vbcrlf

移到下一项

下一个

rs.close

如果minijson = 1

countsql =select count(订单)从表,在哪里

Rs.open CountSql,Conn,1

计算= RS(0)

关闭

获取= tominiui(tmpjson,计数)

其他的

获取= tojson(tmpjson)

最后如果

设置=无

端功能

功能tojson(jsonstr)

tojson ={vbcrlf jsonstr vbcrlf}

端功能

函数的ToMiniUi(jsonstr,总)

tominiui ={

tominiui = tominiui 全:全

tominiui = tominiui 数据:{} jsonstr

tominiui = tominiui} }

端功能



PS:最后的参数的开发miniui可以忽略

以上是本文的全部内容,希望大家能喜欢。