SQLCE connections: Keep them open or close them?

While maintaining performance on a mobile device, what do you think is the best approach to connecting SQLCE. Keep it open for the duration of the application or close it when you need a call to the database.

Obviously, this depends a little on the nature of your application, but I'm curious to know what the group has implemented and why.

+5
source share
3 answers

You definitely need to watch the Steve Lasker PDC08 session on SQL Server Compact Edition . There is a part about performance, best practices and its own tests (~ 37: 00).

In short, keep it open, try reusing commands and use SqlCeResultSet for bulk operations.

+7
source

For my device, I left it open for the entire life of the application. If the functionality of the application depends on the SQLCE connection, this makes sense.

+2
source

Get a late, early release. Open the connection as close as possible to the operation and close it as soon as possible. Open SQL connections are not very good.

-2
source

All Articles