Having SQL Server Connection open throughtout C# windows appliction

  • Thread starter Thread starter AS
  • Start date Start date
A

AS

Hi,


I have a C# windows desktop application that will be used only by one
user at a time. The database server (SQL Server 2000) also resides on
that machine only.


This application has three logical layers (UI, Business layer and
DataAccess layer). Currently, SQL Server connection is opened when a
user first logs in. This connection object (a global variable) is
passed from every form to the business layer and then to the data
access layer where it is used. Finally, when the user logs out, the
connection is closed.


I am not sure if this is an efficient method. I would rather like to
open conenction in the data access layer when required and close the
connection once the job is done.


But I am not clear about the advantages and disadvantages of either of
these approaches. Any advice would be appreciated.
 
Answered in microsoft.public.dotnet.languages.csharp

(grumbles about cross-posting... <g>)

Marc
 
Back
Top