Minimum attribute to create connection string using SqlConnection object - ADO.NET

Q.  What are the minimum attribute is required to create a connection string using SqlConnection object?
- Published on 28 Jul 15

a. - Data Source
 - Initial Catalog
 - Integrated security=true
b. - Server
 - Database
 - Integrated security=true
c. Option A and B both are correct
d. None of the above

ANSWER: Option A and B both are correct
 

    Discussion

  • Digvijay   -Posted on 19 Oct 15
    According to above question Option A and B both are correct.
    Example:
    SqlConnection cn = new SqlConnection("data source=(local);initial catalog=Employee;integrated security=true");
    You can also write database in place of initial catalog and server in place of data source.

Post your comment / Share knowledge


Enter the code shown above:
 
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)