application there is a utility for exporting the data from database to XML file and then import the same in another system.
The system is designed using .NET Framework 3.5.
The utility is now failing when trying to export the data around 100000 rows in table. It is giving out of memory exception.
The code snippet is as follows
private void ExportTableAsXml(ref XmlNode rootElement,Hashtable externalParameters)
{
DataTable result = null;
if (commandTypeField == CommandType.StoredProcedure)
{
}
else if (commandTypeField == CommandType.Text)
{
DataSet resultDataSet = xdo.ExecDataSetSQL(sqlStatementField);
if (resultDataSet != null && resultDataSet.Tables.Count > 0)
result = resultDataSet.Tables[0];
}
XmlNode containerElement = rootElement;
if (result != null && result.Rows.Count != 0)
{
if (containerNameField != string.Empty)
containerElement = rootElement.OwnerDocument.CreateElement(containerNameField);
if (!ResultIsXml)
Bojan SaksidaPosted Jun 14, 2009, 7:23 AM
This approach uses MEMORY for storing data, you yust hit your OS limitation (Assuming it is 32Bit, 64bit have higher limit). This limitation is for variables not for entire app. Instead use XmlTextWriter, witch dirrectly writes to file and doesnt use any memory for storing data