Re: global connections

From: Nicholas Paldino [.NET/C# MVP] (mvp_at_spam.guard.caspershouse.com)
Date: 11/09/04


Date: Tue, 9 Nov 2004 10:36:26 -0500

Mike,

    Having a connection open all the time to a database is not a good thing.
If anything, you should be opening and closing it when you need it.

    In general, it would be a good idea to abstract out the data access
stuff. This way, you create a single pipe through which all of your data
access will flow. This is a good thing, because any changes you have to
make will be propogated everywhere (instead of you having to go around and
change everything yourself).

    Hope this helps.

-- 
               - Nicholas Paldino [.NET/C# MVP]
               - mvp@spam.guard.caspershouse.com
"Mike P" <mrp@telcoelectronics.co.uk> wrote in message 
news:efqQdzmxEHA.1396@tk2msftngp13.phx.gbl...
>I am converting a VB6 app to C# and the VB6 app has 1 connection and 3
> recordsets, all global and open all the time so that all the required
> procedures can use them.  Using C#, would it be best to have a global
> connection and datareaders etc, or is it better to put all the db stuff
> into a seperate class and make calls to this whenever I need to
> read/amend data?
>
> Any advice would be really appreciated.
>
>
> Cheers,
>
> Mike
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it! 


Relevant Pages

  • Re: Refresh DB
    ... connection than closing and opening it? ... you can use Requery, which is the same as if you would call Close and ...
    (borland.public.delphi.database.ado)
  • Re: Run-time error 2147217841 Query Timeout expired
    ... Are you opening and closing your connection on each ... app, and expecting to stay alive whilst the app is sleeping between hourly ...
    (microsoft.public.vb.general.discussion)
  • Re: Memory problem - writing to database
    ... > take a lot of resource to keep opening and closing the db connection? ... I'm not even sure that ADO classic doesn't have a clever form of connection ... I also strongly suspect that by ... Don't worry about the fact that you're constantly opening new connections - ...
    (microsoft.public.vb.general.discussion)
  • Re: Run-time error 2147217841 Query Timeout expired
    ... Are you opening and closing your connection on each ... app, and expecting to stay alive whilst the app is sleeping between hourly ...
    (microsoft.public.vb.general.discussion)
  • Re: Word 2000 size limitations
    ... Win XP, Word 2007, dual-core PC: ... When opening the document, Word takes up to a couple of minutes to count the ... When closing a document, nothing seems to happen sometimes. ... If you have no 2003 pro at hand, try a round-trip save through HTML or RTF. ...
    (microsoft.public.word.docmanagement)

Quantcast