濮阳杆衣贸易有限公司

主頁 > 知識庫 > asp實現(xiàn)讀取數(shù)據(jù)庫輸出json代碼

asp實現(xiàn)讀取數(shù)據(jù)庫輸出json代碼

熱門標簽:不封卡外呼系統(tǒng)一般多少錢 重慶外呼電銷系統(tǒng)費用 濰坊呼叫中心外呼系統(tǒng)供應商 地圖標注中心多少錢注冊 電銷機器人一個多少錢 鄭州語音電銷機器人官網(wǎng) 地圖標注不完整被罰款 北京大興區(qū)地圖標注 微信地圖標注有什么用

復制代碼 代碼如下:

Function GetTable(Table,Where,Order,OrderSort,curpage, pagesize,MiniJson)
'Author : nigou
'使用方法 : Response.Write GetTable(Table表名,Where條件,Order主鍵(必須),OrderSort(asc,desc),curpage當前頁, pagesize每頁條數(shù),MiniJson是否輸出為miniUI格式)
'
    dim i, j ,rs
    if OrderSort="" Then OrderSort="asc"
    if Where="" Then Where="asc"
    Set Rs=Server.CreateObject("adodb.recordset")
    if curpage>1 then
        TmpSql="select a.* from ( select top  " (curpage) * pagesize " * from " Table " where " where  " order by " Order " " OrderSort ") a left join ( select top " (curpage-1) * pagesize  " * from " Table "  where " where  " order by " Order " " OrderSort ") b on a." Order "=b." Order " where iif(b." Order ",'0','1')='1'"
    else
        TmpSql="select a.* from ( select top  " (curpage) * pagesize " * from " Table " where " where  " order by " Order " " OrderSort ") a "
    end if
    if pagesize=0 Then TmpSql = "select * from " Table
        Rs.open TmpSql,conn,1,1
        RealSize=Rs.recordcount
        for i=0 to Rs.recordcount-1
            TmpJson= TmpJson "{"
            for j=0 to Rs.fields.count-1
                TmpJson= TmpJson """" (Rs.fields(j).name) """ : "            
                TmpJson= TmpJson """" Rs(j) """"
                if jRs.fields.count-1 then TmpJson= TmpJson " , "
            next
            TmpJson= TmpJson " }"
            if iRs.recordcount-1 then TmpJson= TmpJson ","
            TmpJson= TmpJson vbcrlf
            rs.movenext
        next
        Rs.close
    if MiniJson=1 Then
        CountSql="select count(" order ") from " Table " where " where
        Rs.open CountSql,Conn,1,1
        Counts=Rs(0)
        Rs.Close
        GetTable=ToMiniUi(TmpJson,Counts)
    Else
        GetTable=toJson(TmpJson)
    end if
    Set Rs=nothing
End Function
function toJson(JsonStr)
    toJson="[" vbcrlf JsonStr vbcrlf "]"
end function
Function ToMiniUi(JsonStr,total)
    ToMiniUI="{"
    ToMiniUI=ToMiniUI """total"":"" " total """," vbcrlf
    ToMiniUI=ToMiniUI """data"": [" JsonStr
    ToMiniUI=ToMiniUI "]}"
End Function

PS:最后的參數(shù)是針對miniUI開發(fā)的,可以無視

以上就是本文的全部內(nèi)容了,希望大家能夠喜歡。

您可能感興趣的文章:
  • js讀取json文件片段中的數(shù)據(jù)實例
  • 使用MSScriptControl 在 C# 中讀取json數(shù)據(jù)的方法
  • Android通過json向MySQL中讀寫數(shù)據(jù)的方法詳解【讀取篇】
  • 如何使用ajax讀取Json中的數(shù)據(jù)
  • PHP讀取mssql json數(shù)據(jù)中文亂碼的解決辦法
  • Android App中讀取XML與JSON格式數(shù)據(jù)的基本方法示例
  • js讀取并解析JSON類型數(shù)據(jù)的方法
  • Android中Json數(shù)據(jù)讀取與創(chuàng)建的方法
  • python讀取json文件并將數(shù)據(jù)插入到mongodb的方法
  • litjson讀取數(shù)據(jù)示例
  • javascript 循環(huán)讀取JSON數(shù)據(jù)的代碼
  • JSON 數(shù)據(jù)格式詳解

標簽:揭陽 攀枝花 海南 鶴崗 佛山 汕頭 撫州 唐山

巨人網(wǎng)絡通訊聲明:本文標題《asp實現(xiàn)讀取數(shù)據(jù)庫輸出json代碼》,本文關鍵詞  asp,實現(xiàn),讀取,數(shù)據(jù)庫,輸出,;如發(fā)現(xiàn)本文內(nèi)容存在版權問題,煩請?zhí)峁┫嚓P信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《asp實現(xiàn)讀取數(shù)據(jù)庫輸出json代碼》相關的同類信息!
  • 本頁收集關于asp實現(xiàn)讀取數(shù)據(jù)庫輸出json代碼的相關信息資訊供網(wǎng)民參考!
  • 推薦文章
    勐海县| 泰来县| 西林县| 黄陵县| 韩城市| 屏东县| 宁夏| 海淀区| 衡南县| 昆山市| 河西区| 同仁县| 枣庄市| 壤塘县| 河北省| 康马县| 肇州县| 阳西县| 丰台区| 宜君县| 永宁县| 梨树县| 大丰市| 宁国市| 英吉沙县| 宁安市| 密云县| 陇南市| 汕头市| 东台市| 彰武县| 嘉善县| 股票| 桃源县| 黑龙江省| 米泉市| 舟山市| 布拖县| 城步| 枣强县| 德兴市|