Click here to Skip to main content
15,905,229 members
Home / Discussions / C#
   

C#

 
AnswerRe: Gracefully shutting down threads Pin
CWIZO17-Jan-06 21:15
CWIZO17-Jan-06 21:15 
GeneralRe: Gracefully shutting down threads Pin
User 665818-Jan-06 2:12
User 665818-Jan-06 2:12 
GeneralRe: Gracefully shutting down threads Pin
CWIZO18-Jan-06 3:01
CWIZO18-Jan-06 3:01 
QuestionVS 2005 UK edition Pin
pieterman17-Jan-06 11:44
pieterman17-Jan-06 11:44 
AnswerRe: VS 2005 UK edition Pin
Christian Graus17-Jan-06 14:03
protectorChristian Graus17-Jan-06 14:03 
GeneralRe: VS 2005 UK edition Pin
pieterman18-Jan-06 7:03
pieterman18-Jan-06 7:03 
QuestionTry/Catch Variable Scoping Pin
RobertF5717-Jan-06 11:34
RobertF5717-Jan-06 11:34 
AnswerRe: Try/Catch Variable Scoping Pin
Guffa17-Jan-06 11:50
Guffa17-Jan-06 11:50 
Because, in some cases the rdr variable will not be set. If the ExecuteReader call fails, the rdr variable doesn't get a value. The compiler only lets you use a variable if it's certain that it always has a value.

You should also get the same error message on the line where you call rdr.Close().

In fact, you shouldn't call rdr.Close() at all in the catch section. If the code in the catch section is executed, the rdr variable certainly has no value.

Also, if you get an exception, you shouldn't let the code just go on and try to use the reader anyway, as there is no reader.

---
b { font-weight: normal; }

GeneralRe: Try/Catch Variable Scoping Pin
RobertF5717-Jan-06 11:55
RobertF5717-Jan-06 11:55 
AnswerRe: Try/Catch Variable Scoping Pin
Guffa17-Jan-06 12:14
Guffa17-Jan-06 12:14 
GeneralRe: Try/Catch Variable Scoping Pin
RobertF5717-Jan-06 12:38
RobertF5717-Jan-06 12:38 
QuestionSetup Project - Getting the user selected install directory Pin
dotnetprgrmmr17-Jan-06 11:28
dotnetprgrmmr17-Jan-06 11:28 
AnswerRe: Setup Project - Getting the user selected install directory Pin
Sasuko17-Jan-06 11:48
Sasuko17-Jan-06 11:48 
GeneralRe: Setup Project - Getting the user selected install directory Pin
dotnetprgrmmr17-Jan-06 12:00
dotnetprgrmmr17-Jan-06 12:00 
GeneralRe: Setup Project - Getting the user selected install directory Pin
Sasuko17-Jan-06 12:42
Sasuko17-Jan-06 12:42 
GeneralRe: Setup Project - Getting the user selected install directory Pin
dotnetprgrmmr18-Jan-06 6:09
dotnetprgrmmr18-Jan-06 6:09 
QuestionDatabase VS direct update Pin
Sasuko17-Jan-06 11:19
Sasuko17-Jan-06 11:19 
AnswerRe: Database VS direct update Pin
Guffa17-Jan-06 11:54
Guffa17-Jan-06 11:54 
GeneralRe: Database VS direct update Pin
Sasuko17-Jan-06 12:14
Sasuko17-Jan-06 12:14 
GeneralRe: Database VS direct update Pin
Dave Kreskowiak17-Jan-06 17:25
mveDave Kreskowiak17-Jan-06 17:25 
AnswerRe: Database VS direct update Pin
Guffa19-Jan-06 23:03
Guffa19-Jan-06 23:03 
QuestionMaking the panel invisible?? Pin
VPMahank17-Jan-06 11:12
VPMahank17-Jan-06 11:12 
AnswerRe: Making the panel invisible?? Pin
CWIZO17-Jan-06 21:11
CWIZO17-Jan-06 21:11 
GeneralRe: Making the panel invisible?? Pin
VPMahank18-Jan-06 1:32
VPMahank18-Jan-06 1:32 
QuestionHow can an NT Service cause itself to stop? Pin
dotnetprgrmmr17-Jan-06 11:12
dotnetprgrmmr17-Jan-06 11:12 

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.