Advertisement

03.26.2008 at 04:54AM PDT, ID: 23270033
[x]
Attachment Details

using SQLServer Compact Edition with Enterprise Library/Data Access Application Block

Asked by ozencozturk in .Net Editors & IDEs, C# Programming Language, .NET Framework 2.0

Tags: c#

Hi,
I've implemented some sample code for using SSCE with DAAB. It works fine but after reading "To open a database, open a connection to it with the CreateConnection method. This method creates the keep alive connection. When you are finished using the database, you must explicitly close the keep alive connection to the database with the CloseSharedConnection method. There is only one keep alive connection for each connection string, although you can have multiple connections open for the same connection string." in entlib documentation, I think I am doing something wrong.

What I'm doing now is using DatabaseFactory.CreateDatabase() method whenever i need to access the database and db.ExecuteNonQuery(cmd), db.AddInParameter() and IDataReader rdr = db.ExecuteReader(dbCommand) for data operations. I've tried CreateConnection & Transaction sample in the documentation but it threw an error saying it doesnt support SSCE. What's the best approach to use SSCE with enterprise lib?

One more question, when I use DatabaseFactory.CreateDatabase(), does it return the database having keep alive connection or should I use singleton pattern (maybe some other kind of approach?) for accessing a single database object in whole application?Start Free Trial
 
Loading Advertisement...
 
[+][-]03.26.2008 at 06:03AM PDT, ID: 21211114

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .Net Editors & IDEs, C# Programming Language, .NET Framework 2.0
Tags: c#
Sign Up Now!
Solution Provided By: ripahoratiu
Participating Experts: 1
Solution Grade: B
 
 
[+][-]04.02.2008 at 02:11AM PDT, ID: 21261223

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628