Click here to Skip to main content
15,884,353 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi All,

Basically i am trying to migrate data from SQL Server to SQLCe 4.0; It is an on going process, which means for product versionised DB is managed on SQL Server and i need to create a table in SQLce for desktop application.

Here i am using c# to write a migratory which is migrates data from SQL Server to SQL Ce 4.0

Following is code part:-
// Following statement pulls data from table into Stringbuilder. One of the table contains about 1600000 (Sixteen lack) rows.
StringBuilder strStrings = GetDataToLoad(lstDestTableNeed.Items[z].ToString(), DT, strCols);

When i am trying to convert string builder to List it is showing out of Memory exception, I have tried following three ways. But no luck.

// List<string> strQ = strStrings.ToString().Split('|').ToList();
// IEnumerable<string> strQ = strStrings.ToString().Split('|').AsEnumerable();
//var arrary = strStrings.ToString().Split('|');

help me please.
Posted

1 solution

It looks like you're building a string that contains some formatted version of 1.6 Million rows. Considering no object in .NET can be larger than 2GB in size, including the contents of a StringBuilder, this may be your problem. Or the resulting String object is bigger than that.

Build one line at a time row by row and pass it to whatever you need to. Do NOT build a single string that contains the data for 1.6 Million rows of data!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900