Windows Phone – Max Database Size Problem in SQL CE

If you have encounters an SQLCeException error during a LINQ operation for example Union on a very large data set, check the error message. If the error message shows something like “The database file is larger than the configured maximum database size. This setting takes effect on the first concurrent database connection only.“, then congratulation to you, because you just hit the limit.

The Windows Phone team think any application in phone should not use that much memory, but still some of us might hit this limit. For example like me which required to search through 20,000+ data sets with complicated search conditions. The solution to this problem is pretty simple, add a max database size in the connection string to SQL CE. You will need a complete connection string this time instead of just defind the location of your SQL CE database file.

For example, my connection string before this is as follow:

@"isostore:/CardsDatabase.sdf"

Then after adding the max database size parameter and convert it to a complete connection string, it will become like this:

@"Data Source='isostore:/CardsDatabase.sdf';Max Database Size=64;"

The 64 in the connection string mean I wants to increase the max database size to 64 MB instead of the default value. Hope this little information can help.

by Ooi Keng Siang via Ooiks’s Blog

2 thoughts on “Windows Phone – Max Database Size Problem in SQL CE

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s