Click here to Skip to main content
15,899,313 members
Home / Discussions / C#
   

C#

 
GeneralRe: help for opengl in c# Pin
User 665810-Feb-08 22:00
User 665810-Feb-08 22:00 
GeneralRe: help for opengl in c# Pin
Pete O'Hanlon10-Feb-08 22:03
mvePete O'Hanlon10-Feb-08 22:03 
GeneralConnection string problem Pin
D i x y10-Feb-08 20:06
D i x y10-Feb-08 20:06 
GeneralRe: Connection string problem Pin
N a v a n e e t h10-Feb-08 20:16
N a v a n e e t h10-Feb-08 20:16 
GeneralRe: Connection string problem Pin
Rupesh Kumar Swami10-Feb-08 20:33
Rupesh Kumar Swami10-Feb-08 20:33 
GeneralRe: Connection string problem Pin
Mircea Puiu10-Feb-08 23:17
Mircea Puiu10-Feb-08 23:17 
GeneralRe: Connection string problem [modified] Pin
Harvey Saayman11-Feb-08 0:28
Harvey Saayman11-Feb-08 0:28 
GeneralRe: Connection string problem Pin
Pete O'Hanlon11-Feb-08 2:37
mvePete O'Hanlon11-Feb-08 2:37 
HarveySaayman wrote:
if u make a new connection every time u want to get data from a database you cause unnecicary overhead and lag when you are opening the window (assuming u make the connection OnFormLoad)

what you sould be doing is making a connection when the program starts up in the Main() method

then when you open a new window u send the instance of the dataBaseConnection to that form


WTF | :WTF: Tell me you're joking. Please.

This is the worst thing that you could do. When you do this, you have opened a persistent connection to the database which doesn't get closed until your application exits. This means that your application isn't scalable. More importantly, it doesn't cater for the fact that the database may go down and come back up between calls. If this happens, then your connection is no longer valid.

The general rule is acquire a connection as late as possible and release it as early as possible because a connection is a "precious" resource. If you have pooling enabled, then new connections will merely pull the connection from the pool (dependent on the connection string you pass in).

The correct way to do this (from .NET 2 on) is to put an entry in the ConnectionStrings section in the config file. Then use ConfigurationManager.ConnectionStrings["ConnectionStringNameHere"].ConnectionString to retrieve the actual connection string.


Deja View - the feeling that you've seen this post before.

My blog | My articles



GeneralRe: Connection string problem Pin
Harvey Saayman11-Feb-08 22:57
Harvey Saayman11-Feb-08 22:57 
GeneralRe: Connection string problem Pin
Dave Kreskowiak11-Feb-08 3:49
mveDave Kreskowiak11-Feb-08 3:49 
GeneralRe: Connection string problem Pin
Pete O'Hanlon11-Feb-08 2:41
mvePete O'Hanlon11-Feb-08 2:41 
GeneralRe: Connection string problem Pin
D i x y11-Feb-08 17:06
D i x y11-Feb-08 17:06 
GeneralRe: Connection string problem Pin
Harvey Saayman11-Feb-08 20:35
Harvey Saayman11-Feb-08 20:35 
GeneralRe: Connection string problem Pin
Ravenet11-Feb-08 3:10
Ravenet11-Feb-08 3:10 
QuestionHow to Add a Font in Setup Project Pin
Bajrang Singh10-Feb-08 20:04
Bajrang Singh10-Feb-08 20:04 
AnswerRe: How to Add a Font in Setup Project Pin
Rupesh Kumar Swami10-Feb-08 20:18
Rupesh Kumar Swami10-Feb-08 20:18 
AnswerRe: How to Add a Font in Setup Project Pin
Giorgi Dalakishvili10-Feb-08 20:25
mentorGiorgi Dalakishvili10-Feb-08 20:25 
GeneralRe: How to Add a Font in Setup Project Pin
Rupesh Kumar Swami10-Feb-08 20:39
Rupesh Kumar Swami10-Feb-08 20:39 
GeneralAn unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll in c# Pin
ramyanaidu10-Feb-08 18:36
ramyanaidu10-Feb-08 18:36 
GeneralRe: An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll in c# Pin
Martin#10-Feb-08 20:24
Martin#10-Feb-08 20:24 
GeneralPrinting 128-bit integer in decimal Pin
Skippums10-Feb-08 15:59
Skippums10-Feb-08 15:59 
GeneralRe: Printing 128-bit integer in decimal Pin
Luc Pattyn11-Feb-08 1:41
sitebuilderLuc Pattyn11-Feb-08 1:41 
GeneralRe: Printing 128-bit integer in decimal Pin
Skippums11-Feb-08 5:20
Skippums11-Feb-08 5:20 
GeneralRe: Printing 128-bit integer in decimal Pin
Luc Pattyn11-Feb-08 6:06
sitebuilderLuc Pattyn11-Feb-08 6:06 
AnswerRe: Printing 128-bit integer in decimal Pin
Skippums11-Feb-08 5:50
Skippums11-Feb-08 5:50 

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.