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);

}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
  • 2022-12-23
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-27
  • 2022-12-23
  • 2021-10-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
相关资源
相似解决方案