zoukankan      html  css  js  c++  java
  • DataTable 转换为ArrayList 再转换成 json 格式

      //JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
            //javaScriptSerializer.MaxJsonLength = Int32.MaxValue; //取得最大数值
            //ArrayList arrayList = new ArrayList();
            //foreach (DataRow dataRow in dt.Rows)
            //{
            //    Dictionary<string, object> dictionary = new Dictionary<string, object>();  //实例化一个参数集合
            //    foreach (DataColumn dataColumn in dt.Columns)
            //    {
            //        dictionary.Add(dataColumn.ColumnName, dataRow[dataColumn.ColumnName].ToString());
            //    }
            //    arrayList.Add(dictionary); //ArrayList集合中添加键值
            //}
            //return javaScriptSerializer.Serialize(arrayList);  //返回一个json字符串

  • 相关阅读:
    散列
    AVL树的单旋与双旋
    Ubuntu系统目录
    os x文件系统结构简介
    c语言静态局部变量
    创建J2EE 5.0工程后,JSTL不能使用解决方法
    mysql
    指针
    servlet 访问项目
    c数组
  • 原文地址:https://www.cnblogs.com/liouxing199/p/5896288.html
Copyright © 2011-2022 走看看