How to Create a SqlConnection Object in Ado.Net?

How to Create a SqlConnection Object in Ado.Net?

SqlConnection object is like a c# object.The object declare like that:
 SqlConnection conn = new SqlConnection(
"Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI"); 
This argument is called a connection string. It is define as:
Data Source:  Identifies the server.  
Integrated Security:  Set to SSPI to make connection with user's Windows login
User ID:  Name of user configured in SQL Server. 
Password:  Password matching SQL Server User ID.
Using a SqlConnetion the connection creates as:
1.Instantiate the SqlConnection. 
2.Open the connection. 
3.Pass the connection to other ADO.NET objects. 
4.Perform database operations with the other ADO.NET objects. 
5.Close the connection.

Date:2028-10-10 00:00:00

Post Your Answers

User Email:

User Name:

Related ADO.NET Subjective Links

ADO.NET Subjective interview questions and answers for experienced and fresher