將查詢出來的資料集轉化成JSON格式的類

2021-06-16 15:27:43 字數 958 閱讀 4443

using system;

using system.collections;

using system.collections.generic;

using system.data;

using system.globalization;

using system.linq;

using system.reflection;

using system.text;

using system.web;

namespace wikeasyuidemo

else

}///

/// 將datatable中的資料轉換成json格式

///

/// 資料來源datatable

/// 是否輸出資料總條數

///

public static string createjsonparameters(datatable dt, bool displaycount)

///

/// 將datatable中的資料轉換成json格式

///

/// 資料來源datatable

///

public static string createjsonparameters(datatable dt)

///

/// 將datatable中的資料轉換成json格式

///

/// 資料來源datatable

/// 是否輸出資料總條數

/// json中顯示的資料總條數

///

public static string createjsonparameters(datatable dt, bool displaycount, int totalcount)

#endregion}}

查詢最終結果:

],"total":1}

將資料庫查詢出來的資料轉化成樹形結構

從資料庫查詢的每一條資料都包含id和fid欄位,將獲得的資料轉換成樹形結構 假設從資料庫查詢出來的資料對應的實體類 public class department public department int id,int fid,string name,listlist 將獲得資料轉化成屬性結構 p...

MYSQL如何修改查詢出來的結果集

update expresspackage set isuploadsto 200 where billcode in select billcode from expresspackage where reallatticeno not in 224,448 and status 0 and do...

MongoDB匯出查詢出來的資料集合

第一步 將查詢的結果生成一張臨時表 use 資料庫 var result db.集合名.find while result.hasnext db.temp 臨時表 insert result.next 第二步 需要認證 mongoexport h cdn或者ip d 資料庫名 port 埠號 use...