G
Guest
When I compile the following code fragment, the compiler errors saying the variable connection is not initialized. As I understand C#, I thought it would be initialized. Please help me and explain what I am missing
Bil
static void Main(string[] args
SqlConnection connection
try // to open the connection to the database
connection=new SqlConnection((string)( System.Configuration.ConfigurationSettings.AppSettings["SQLConnection"]))
connection.Open()
catch (Exception e
ProcessInitialException(e)
Environment.Exit(0)
if (args.Length!=2
ProcessArguementError(args)
Environment.Exit(0)
string eventType=args[0]
string userEvent=args[1]
SqlCommand command=new SqlCommand("RetrieveNotificationUsers",connection)
Bil
static void Main(string[] args
SqlConnection connection
try // to open the connection to the database
connection=new SqlConnection((string)( System.Configuration.ConfigurationSettings.AppSettings["SQLConnection"]))
connection.Open()
catch (Exception e
ProcessInitialException(e)
Environment.Exit(0)
if (args.Length!=2
ProcessArguementError(args)
Environment.Exit(0)
string eventType=args[0]
string userEvent=args[1]
SqlCommand command=new SqlCommand("RetrieveNotificationUsers",connection)