Create SQL Server Connection Objects in Code - ADO.NET
Q. How will you create the SQL Server Connection Objects in Code? Choose the correct option.- Published on 28 Jul 15a. SqlConnection con = new SqlConnection ("Data Source=ServerName; Initial Catalog=DatabaseName;Integrated Security=True");
b. SqlConnection con = new SqlConnection();
con.ConnectionString = ("Data Source=ServerName; Initial Catalog=DatabaseName;Integrated Security=True");
c. using (SqlConnection con = new SqlConnection("Data Source=ServerName; Initial Catalog=DatabaseName;Integrated Security=True"))
{
con.Open();
- - - - - -
- - - - - -
}
d. All of the above codes are correct.
ANSWER: All of the above codes are correct.