views:

125

answers:

2

Hi

Is it possible to open 2 connection to database (.sdf file's) on windows mobile ?

(frameWork 3.5)

if yes, how can I do it ?

thank's in advance

A: 

If you use SQL CE 3.5 you you can. How to do it? Just like you normally open connections.

For instance, I have my apprunning currently while MSSQL Management studio 2008 also has a connection to the database, and hench i can look at the data while the db is running.

+1  A: 

Could be I'm doing something wrong, but for SQL Server CE I keep the same connection open and share it for all of my calls. You could get into issues if you are threading calls, but by in large you are ok.

Big difference between connections in SQL Server and SQL Server CE is that you do NOT get connection pooling in SQL Server CE. When you close a connection in CE, it is gone. And opening connections can be expensive.

Chris Brandsma
we'll soon be going to a shared connection due to performance problems. We used to open up a new connection for pretty much all data access operations, but that was causing some problems with bad performance.
tjjjohnson
One note: I do open multiple connections: one per thread. There are a few cases where I invoke multi-threading, and you need a new connection for each thread or you will start seeing very strange errors.
Chris Brandsma