Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Performance with SqlCeConnection

55 views
Skip to first unread message

Tsukamoto@discussions.microsoft.com Julio Tsukamoto

unread,
Feb 24, 2005, 3:05:06 PM2/24/05
to
Please,
What is the better choice with the SqlCeConnection.Open / .Close :

1 - Open the Connection and Keep always open while the application is
running and Close only when the application is Ended.
or
2 - Open and Close the Connection after use every time is necessary.
??
Tanks

W.G. Ryan eMVP

unread,
Feb 24, 2005, 7:57:46 PM2/24/05
to
It really depends on your application. In general - I'd have a strong bias
toward closing your connections - store the data in a Dataset and use it
throughout the program - CE works the opposite though of normal
SqlConnection objects - you can only open one instance but you can fire
multiple commadns on it - with that said, I still personally lean toward
closing my stuff and writing to the actual db only when I have to.

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"Julio Tsukamoto" <Julio Tsuk...@discussions.microsoft.com> wrote in
message news:318E3D55-39D5-443A...@microsoft.com...

Arun

unread,
Mar 11, 2005, 5:39:03 AM3/11/05
to
Hi Julio,

Its a common practise to have a single global connection for the entire
application for perfomance.
Open it when the application starts using the database. There are some
times you have to check the state of the connection using ConnectionState
property, mostly while you work with DataReader as it needs a live
connection, and open if found closed. Its a best practise to fill you
DataSets and close the connection if there is no further need with the
command objects and data readers.

0 new messages