variable scope
-
Hi all, A beginners question: I define
SqlCommand myCommand;
in a function I then dotry { myCommand = new SqlCommand(mySelectQuery,mySQLConnection); } catch(System.Exception e) {}
I get an errormessageUse of unasigned local variable myCommand
I see why I get the message but have no real clue on how I can use the try - catch without casting the errormessage. regards Stijn
-
Hi all, A beginners question: I define
SqlCommand myCommand;
in a function I then dotry { myCommand = new SqlCommand(mySelectQuery,mySQLConnection); } catch(System.Exception e) {}
I get an errormessageUse of unasigned local variable myCommand
I see why I get the message but have no real clue on how I can use the try - catch without casting the errormessage. regards Stijn
try assigning the command a null value :
SqlCommand myCommand = null;
I hope you understand... By the way... visit http://nehe.gamedev.net[^]