DataTable转换为Json
时间:2011-05-25 来源:#阿志#
1.这里下载:http://www.newtonsoft.com/products/json/
安装:
1.解压下载文件,得到Newtonsoft.Json.dll
2.在项目中添加引用
2.引入命名空间
using Newtonsoft.Json; using Newtonsoft.Json.Converters;
3.把datatable转换成json格式
public string GetAllCategory()
{
string result = "";
DataTable dt= catDAO.GetAllCategory();
result=JsonConvert.SerializeObject(dt, new DataTableConverter());
return result;
} 相关阅读 更多 +
排行榜 更多 +










