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

C#

 
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 
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 
Software2007 wrote:
am i missing something here?

Big style. It's called scalability. Database connections are expensive resources, and should be treated as precious resources.

Software2007 wrote:
But, I don't like to open it up every time I query the db


So, laziness is a virtue in your world?

Software2007 wrote:
In my main program in C#, I can open a connection to postgresdb , do some queries and close connection afterwards.


Is it a desktop application? If it's a web application then you can't do this anyway, so you might as well get used to the idea of acquiring the connection at the last minute and releasing it as soon as possible.

Here's a poser for you. Suppose you open your connection at the start of your application and your code relies on this connection being open. Now, suppose that the database crashes and restarts between you querying it. What do you think will happen the next time you issue a query? If you guessed that the code will fail, go to the top of the class. If you think you can rely on the connection always being available, slap yourself around the head with a pink halibut and call yourself Ethel.

I'm not a stalker, I just know things. Oh by the way, you're out of milk.

Forgive your enemies - it messes with their heads


My blog | My articles | MoXAML PowerToys | Onyx


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 
AnswerRe: Access asymbly version Pin
Richard MacCutchan1-Mar-11 3:21
mveRichard MacCutchan1-Mar-11 3:21 
QuestionCreating xml file using SAX parser Pin
NarVish1-Mar-11 2:18
NarVish1-Mar-11 2:18 

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.