标签:
public string GetJson(DataTable dt){
JavaScriptSerializer jss=new JavaScriptSerializer();
jss.MaxJsonLength=Int32.MaxValue;
System.Collections.Arraylist dic=new System.Collections.ArrayList();
foreach(DataRow dr in dt.Rows){
System.Collections.Generic.Dictionary<string,string> drow=new System.Collections.Generic.Dictionary<string,string>();
foreach(DataColumn dc in dt.Columns){
drow.Add(dc.ColumnName,dr[dc.ColumnName]);
}
dic.Add(drow);
}
return jss.Serialize(dic);
}
标签:
原文地址:http://www.cnblogs.com/sujingnuli/p/5780599.html