Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server CE / October 2007

Tip: Looking for answers? Try searching our database.

What is best SQLCeConnection strategy?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Adam - 29 Oct 2007 18:26 GMT
hi
I would like to know what's better in C# compact framework programming

To declare a SQLCeConnection variable as a Static member of
a Class containing functions to MakeConnection and
CloseConnection, or should I just declare it as a Public
member of the above mentioned class containing Connection
code.

And, if better is use a static SQLCeConnection should i use open a
connection once or open before a execute an query and close after it?

Thanks
William Vaughn - 30 Oct 2007 17:31 GMT
It does not make much difference--BUT, when the connection is closed for the
last time, the engine compacts the database. This means that no matter what
strategy you choose, you need to make sure to leave at least one connection
open until the application is ready to end.

Signature

____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

> hi
> I would like to know what's better in C# compact framework programming
[quoted text clipped - 9 lines]
>
> Thanks
Adam - 30 Oct 2007 18:53 GMT
Dnia Tue, 30 Oct 2007 09:31:24 -0700, William Vaughn napisał(a):

> It does not make much difference--BUT, when the connection is closed for the
> last time, the engine compacts the database. This means that no matter what
> strategy you choose, you need to make sure to leave at least one connection
> open until the application is ready to end.

In fact i've used sqlce 2.0 so the engine doesn't compact the database.I've
read that constant opening and closing (with dispose) cause taking too much
place in the memory. So, as long as i use only open and close (without
dispose) everything is ok?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.