What happens if a database reaches the limit of 4GB of the SQL Server Compact Edition? Is there a special exception for this?
Can I safely catch this event or exception and, let's say, create a new database?
It includes both 32-bit and 64-bit native support. SQL CE targets occasionally connected applications and applications with an embedded database. It is free to download and redistribute.
SQL Server Compact 3.5 SP2 is an embedded database that allows developers to build robust applications for Windows desktops and mobile devices.
In Enterprise Manager, right-click on the desired SQL Server instance and click Properties. In the properties dialog box, click the Memory tab. Under the Maximum (MB) slider option, move the slider to the desired maximum value. Click OK to save your changes.
I have not experienced this myself, but it looks like a SqlCeException
will be thrown and the NativeError
property of the contained SqlCeError will have an error code of 25104 (SSCE_M_DATABASETOOBIG).
Here's a listing of SqlCeError
Native Codes related to db engine errors -- the one about the db file being too big is about 2/3 of the way down. The listing is for SQL CE 3.5; you didn't specify what version you were using, but I'm guessing that it wouldn't change.
I don't see why you couldn't catch this exception and then create a new database in your catch
section.
try {
//do something
} catch (SqlCeException cexc){
foeach (SqlCeError aError in cexc.Errors) {
if (aError.NativeError == 25104) { //this is the code for the TOO BIG error code
//handle too big error -- maybe create a new database
}
}
}
I hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With