Click here to Skip to main content
15,890,512 members
Home / Discussions / C#
   

C#

 
AnswerRe: Load picture from resource file with XAML Pin
Pete O'Hanlon1-Mar-11 21:31
mvePete O'Hanlon1-Mar-11 21:31 
GeneralRe: Load picture from resource file with XAML Pin
Mc_Topaz1-Mar-11 21:36
Mc_Topaz1-Mar-11 21:36 
AnswerRe: Load picture from resource file with XAML Pin
ltuljo2-Mar-11 14:46
ltuljo2-Mar-11 14:46 
QuestionPostgres database connection Pin
Software20071-Mar-11 9:32
Software20071-Mar-11 9:32 
AnswerRe: Postgres database connection Pin
Orcun Iyigun1-Mar-11 9:38
Orcun Iyigun1-Mar-11 9:38 
GeneralRe: Postgres database connection Pin
Software20071-Mar-11 9:45
Software20071-Mar-11 9:45 
GeneralRe: Postgres database connection Pin
Dave Kreskowiak1-Mar-11 9:46
mveDave Kreskowiak1-Mar-11 9:46 
AnswerRe: Postgres database connection Pin
Dave Kreskowiak1-Mar-11 9:45
mveDave Kreskowiak1-Mar-11 9:45 
Software2007 wrote:
I can open a connection to postgresdb , do some queries and close connection
afterwards. But, I don't like to open it up every time I query the db


Tough. That's the "best practice" method to use.


Software2007 wrote:
is there a way where the db stays opened for the life of the application, so I
can query things anytime through out the life of the program and only close when
I kill the app


Bad idea. Database connection licenses are expensive. So, to minimize costs, you are expected to open the connection, use it, then close it as soon as possible so another application can use the connection license on the server.

Think about it. You open a connection for the life of your app, then your app crashes or the network connection goes down, but the SQL connection is never released. Now you've got a connection license being used on the server, but never being used until it's cleared out manually or the connection times out on the server for inactivity.


Software2007 wrote:
How is it normally done in big apps


Open the connection, query it, close it.

GeneralRe: Postgres database connection Pin
Software20071-Mar-11 9:56
Software20071-Mar-11 9:56 
AnswerRe: Postgres database connection Pin
Pete O'Hanlon1-Mar-11 9:56
mvePete O'Hanlon1-Mar-11 9:56 
GeneralRe: Postgres database connection Pin
Software20071-Mar-11 10:26
Software20071-Mar-11 10:26 
GeneralRe: Postgres database connection Pin
Pete O'Hanlon1-Mar-11 10:34
mvePete O'Hanlon1-Mar-11 10:34 
GeneralRe: Postgres database connection Pin
Software20071-Mar-11 10:40
Software20071-Mar-11 10:40 
AnswerRe: Postgres database connection Pin
PIEBALDconsult1-Mar-11 13:55
mvePIEBALDconsult1-Mar-11 13:55 
QuestionFile.Move() method Pin
Orcun Iyigun1-Mar-11 9:30
Orcun Iyigun1-Mar-11 9:30 
AnswerRe: File.Move() method Pin
Dave Kreskowiak1-Mar-11 9:39
mveDave Kreskowiak1-Mar-11 9:39 
GeneralRe: File.Move() method Pin
Orcun Iyigun1-Mar-11 10:05
Orcun Iyigun1-Mar-11 10:05 
QuestionAccess asymbly version Pin
jashimu1-Mar-11 3:02
jashimu1-Mar-11 3:02 
AnswerRe: Access asymbly version Pin
musefan1-Mar-11 3:15
musefan1-Mar-11 3:15 
GeneralRe: Access asymbly version Pin
jashimu1-Mar-11 3:22
jashimu1-Mar-11 3:22 
AnswerRe: Access asymbly version Pin
musefan1-Mar-11 3:26
musefan1-Mar-11 3:26 
AnswerRe: Access asymbly version Pin
Henry Minute1-Mar-11 3:16
Henry Minute1-Mar-11 3:16 
GeneralRe: Access asymbly version Pin
musefan1-Mar-11 3:22
musefan1-Mar-11 3:22 
GeneralRe: Access asymbly version Pin
Henry Minute1-Mar-11 3:24
Henry Minute1-Mar-11 3:24 
GeneralRe: Access asymbly version Pin
musefan1-Mar-11 3:29
musefan1-Mar-11 3:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.