Multiple choice technology web technology

Syntax for creating a connection object

  1. SqlConnection conn = new SqlConnection(

  2. SqlConnection conn=null; conn=new SqlConnection(

  3. SqlConnection conn = SqlConnection(

  4. All the above

Reveal answer Fill a bubble to check yourself
A,B Correct answer
Explanation

Option A shows the standard one-line declaration and instantiation of SqlConnection. Option B demonstrates two-step initialization: first declaring null, then assigning with new keyword. Both are valid C# syntax patterns. Option C is incorrect because it omits the 'new' keyword required for object instantiation.