Increase the size of sql compact 3.5 .sdf file

Jankhana picture Jankhana · Mar 9, 2010 · Viewed 22.9k times · Source

I'm using Sql Compact3.5 as my DB with C# .NET what is the maximum size of sdf that I can give? Is there any way to programatically increase the maximum size of the sdf file? If so how?

Answer

Benny Jobigan picture Benny Jobigan · Mar 9, 2010

The maximum size of the database is by default 128 MB. Override this by using the following connection string.

Data Source=MyData.sdf;Max Database Size=256;Persist Security Info=False;

(from: http://www.connectionstrings.com/sql-server-2005-ce) and (from: http://msdn.microsoft.com/...)

The absolute maximum size of the database is 4gb.