public static class JsonHelper
{
public static string DataTableToJSon(DataTable dt)
{
JavaScriptSerializer jss = new JavaScriptSerializer();
return jss.Serialize(DataTableToList(dt));
}
private static List<Hashtable> DataTableToList(DataTable dt)
{
List<Hashtable> rtn = new List<Hashtable>();
foreach (DataRow row in dt.Rows)
{
rtn.Add(DataRowToHashTable(dt.Columns, row));
}
return rtn;
}
private static Hashtable DataRowToHashTable(DataColumnCollection cols, DataRow row)
{
Hashtable htRow = new Hashtable();
foreach (DataColumn col in cols)
{
htRow.Add(col.ColumnName, row[col.ColumnName]);
}
return htRow;
}
}
===================================================================
DataSet ds = new DatasSet();
String table0 = JsonHelper.DataTableToJSon(ds.Tables[0]);
String table1 = JsonHelper.DataTableToJSon(ds.Tables[1]);
String table2 = JsonHelper.DataTableToJSon(ds.Tables[2]);
String table3 = JsonHelper.DataTableToJSon(ds.Tables[3]);
String result = String.Format("{0}<DIVIDE></DIVIDE>{1}<DIVIDE></DIVIDE>{2}<DIVIDE></DIVIDE>{3}", table0, table1, table2, table3);
===================================================================
var list = data.split("<DIVIDE></DIVIDE>");
var table0 = eval(list[0]);
var table1 = eval(list[1]);
var table2 = eval(list[2]);
var table3 = eval(list[3]);
name
is a very bad parameter name is your case – Artur Udod Jun 6 '13 at 21:29Dictionary
– Artur Udod Jun 6 '13 at 21:31