I am trying to set the 'max database size' attribute for a SQL Server ce database. From what I understand, this is done by passing the desired maximum size (in MB) on the connection string to the CE database. When I open the database in MS SQL Server Management Studio Express, I have an advanced option to set this and it affects all subsequent, concurrent connnections (only the first one in gets to set max size). So if I open the DB there first, then run my app, it works fine. If I don't, I hit the default limit of 256 MB. I have tried setting it as a parameter to my TSQLConnection object (params.add('max database size=2048')) but that seems to have no effect. I'm not sure if this is a TSQLConnection issue, or a driver issue or I'm just not doing it right, but since the only way I've found to connect to MS SQL CE databases is using Devart, I thought I'd start by asking here.
Here's a code snippet showing how I'm setting the attributes:
cnMain.DriverName := DriverName;
cnMain.GetDriverFunc := GetDriverFunc;
cnMain.LibraryName := LibraryName;
cnMain.VendorLib := VendorLib;
cnMain.Params.Add('max database size=2048');
cnMain is my TSQLConnection and aside from the size issue, everything works. Any help, insight or direction would be appreciated. Thanks.
Settig SQL Server CE 'max database size'
I tried it without the TSQLConnecion. Using Data Explorer in the IDE, I clicked 'Modify Connection' and then 'Advanced' then right-click in the misc area of the Advanced Properties page and choose 'Add'. I then add a property named 'max database size' and set it to 2048 (my db is 1016 MB). After that, I can see that my connection string at the bottom of the screen now shows the value set as I'd hoped, but I still get the same error. So, now I'm thinking it's a Devart issue.
How to access this functionality
I see that this is now in the latest build, but I don't see anything in the documentation that shows how to use it. My attempts at the obvious were unsuccessful.
To set the 'max database size' attribute for a SQL Server CE database, you should set appropriate parameter of TCRSQLConnection, like this:
Code: Select all
TCRSQLConnection.Params.Values['Custom String'] := 'MaxDatabaseSize=2048';