I have a very large List of Objects (Totaling 186799) which I am attempting to port to a DataTable in JSON format. The total length of the Serialized list of objects is 62553299. How can I port this data from a webservice in JSON format to a DataTable in a aspx file.
public void GetData()
{
DataTable dt;
string connectionString = "----";
string selectCommand = "SELECT -----";
using (AdomdConnection conn = new AdomdConnection(connectionString))
{
conn.Open();
using (AdomdDataAdapter adapter = new AdomdDataAdapter (selectCommand, conn))
{
dt = new DataTable();
adapter.Fill(dt);
List<ResourceData> ResourceInfo = new List<ResourceData>();
ResourceData ResourceInfoRow = null;
foreach (DataRow dr in dt.Rows)
{
ResourceInfoRow = new ResourceData();
ResourceInfoRow.SourceProject = dr.ItemArray[0].ToString();
ResourceInfoRow.SourceFile= dr.ItemArray[1].ToString();
ResourceInfoRow.Project = dr.ItemArray[2].ToString();
ResourceInfoRow.File = dr.ItemArray[3].ToString();
ResourceInfoRow.Parent = dr.ItemArray[4].ToString();
ResourceInfoRow.Id = dr.ItemArray[5].ToString();
ResourceInfo.Add(ResourceInfoRow);
}
JavaScriptSerializer js = new JavaScriptSerializer();
js.MaxJsonLength = 2147483647;
Context.Response.Write(js.Serialize(ResourceInfo)); //This is where I hit the OutOfMemoryException
}
conn.Close();
}
}
I have to port the data back in json format since I am using a DataTable plugin.
Thank you for your responses.