private void Form1_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection(); try { con.ConnectionString = @"Data Source =server;Initial Catalog = pubs;userid=sa;password=password"; con.Open(); } finally { if (con.State = ConnectionState.Open) MessageBox.Show("Connection Successful"); else MessageBox.Show("Unsuccessful"); } } What is the output?

 Posted by deccansoft on 8/5/2010 | Category: C# Interview questions | Views: 3969

MessageBox------------->Unsuccessful. We will get run time error because User Id is the keyword.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response