Click here to Skip to main content
16,017,881 members
Home / Discussions / C#
   

C#

 
QuestionConnecting SQL Server 2005 from VS.Net 2005 Pin
Banjo Ayorinde22-Aug-07 1:02
Banjo Ayorinde22-Aug-07 1:02 
AnswerRe: Connecting SQL Server 2005 from VS.Net 2005 Pin
Rocky#22-Aug-07 1:06
Rocky#22-Aug-07 1:06 
Questionhelp on project Pin
himanshu p taunk22-Aug-07 0:47
himanshu p taunk22-Aug-07 0:47 
AnswerRe: help on project Pin
Christian Graus22-Aug-07 0:55
protectorChristian Graus22-Aug-07 0:55 
AnswerRe: help on project Pin
J4amieC22-Aug-07 1:01
J4amieC22-Aug-07 1:01 
GeneralRe: help on project Pin
himanshu p taunk22-Aug-07 1:11
himanshu p taunk22-Aug-07 1:11 
GeneralRe: help on project Pin
Rocky#22-Aug-07 1:17
Rocky#22-Aug-07 1:17 
AnswerRe: help on project Pin
Guffa22-Aug-07 2:52
Guffa22-Aug-07 2:52 
That code is not very good. You are opening a new database connection for every single query you run, which is just a waste of resources.

Even worse, the ExecuteCommand method opens a connection that is never closed. Only if there was an exception the code closes a connection, but that is not the connection that was open earlier. Instead it opens a completely new connection that is immediately closed.

The ExecuteCommand is bad in another way. It catches any type of exception, discards it and just return an unusable value. If you catch exceptions, only catch the ones that you handle, and really handle the ones that you catch.

---
single minded; short sighted; long gone;

GeneralRe: help on project Pin
Brady Kelly22-Aug-07 3:31
Brady Kelly22-Aug-07 3:31 
AnswerRe: help on project Pin
Guffa23-Aug-07 0:22
Guffa23-Aug-07 0:22 
GeneralRe: help on project Pin
himanshu p taunk23-Aug-07 7:11
himanshu p taunk23-Aug-07 7:11 
QuestionConnecting SQLExpress codes Pin
Banjo Ayorinde22-Aug-07 0:45
Banjo Ayorinde22-Aug-07 0:45 
AnswerRe: Connecting SQLExpress codes Pin
himanshu p taunk22-Aug-07 0:50
himanshu p taunk22-Aug-07 0:50 
QuestionHow to set a reminder in c# Pin
Vivekanandan22-Aug-07 0:38
Vivekanandan22-Aug-07 0:38 
AnswerRe: How to set a reminder in c# Pin
Christian Graus22-Aug-07 0:57
protectorChristian Graus22-Aug-07 0:57 
GeneralRe: How to set a reminder in c# Pin
led mike22-Aug-07 4:33
led mike22-Aug-07 4:33 
Questionchanging color of disabled controls Pin
cignox122-Aug-07 0:34
cignox122-Aug-07 0:34 
AnswerRe: changing color of disabled controls Pin
JoeSharp22-Aug-07 0:57
JoeSharp22-Aug-07 0:57 
GeneralRe: changing color of disabled controls Pin
cignox122-Aug-07 1:30
cignox122-Aug-07 1:30 
GeneralRe: changing color of disabled controls Pin
Martin#22-Aug-07 1:34
Martin#22-Aug-07 1:34 
QuestionAccess webmail ? (like hotmail, etc) Pin
finskiy22-Aug-07 0:33
finskiy22-Aug-07 0:33 
AnswerRe: Access webmail ? (like hotmail, etc) Pin
Christian Graus22-Aug-07 1:00
protectorChristian Graus22-Aug-07 1:00 
AnswerRe: Access webmail ? (like hotmail, etc) Pin
SpiveyC#22-Aug-07 2:14
SpiveyC#22-Aug-07 2:14 
Questiondisappearing bitmap Pin
smsurendar22-Aug-07 0:07
smsurendar22-Aug-07 0:07 
AnswerRe: disappearing bitmap Pin
Luc Pattyn22-Aug-07 0:15
sitebuilderLuc Pattyn22-Aug-07 0:15 

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.