public string getSendDetailQuery(DateTime timeS
{
try
{
SmsOperate so = new SmsOperate()
//得到dt
DataTable dtt = so
JavaScriptSerializer serializer = new JavaScriptSerializer()
string aaa = Serialize(dtt
return
}
catch (Exception e)
{
return
}
}
/// <summary>序列化方法
/// 不需要分頁
/// </summary>
/// <param name=
/// <param name=
/// <returns></returns>
public string Serialize(DataTable dt
{
JavaScriptSerializer serializer = new JavaScriptSerializer()
List<Dictionary<string
foreach (DataRow dr in dt
{
Dictionary<string
foreach (DataColumn dc in dt
{
result
}
list
}
return serializer
}
//反序列化
public DataTable getSendDetailTest()
{
DataTable dtb = new DataTable()
//得到序列化結果aaa
string aaa = getSendDetailQuery(Convert
if (aaa
{
try
{
JavaScriptSerializer serializer = new JavaScriptSerializer()
// var obj = serializer
ArrayList dic = serializer
if (dic
{
foreach (Dictionary<string
{
if (dtb
{
foreach (string key in drow
{
dtb
}
}
DataRow row = dtb
foreach (string key in drow
{
row[key] = drow[key];//添加列值
}
dtb
}
}
}
catch (Exception e)
{
//
}
}
else
{
//
}
return dtb;
}
From:http://tw.wingwit.com/Article/program/net/201311/12385.html