ADO.Net Interview Questions and Answers
<< Previous Question Next Question >>
 Question: 1878 Page Views: 

Write the Connection String used in ADO.Net to connect with SQL Server database?



Posted By: Avi Date: 2 December 2009 12:23:20 AM
 Answer:

Connection String with SQL Server Security Authentication (needs to include UserID and Password of database):

"Data Source=ServerName; Initial Catalog=DatabaseName; User Id=UserName; Password=UserPassword;"

Connection String with Trusted Authentication (UserID and Password of database is not required):

"Data Source=ServerName; Initial Catalog=DatabaseName; Integrated Security=SSPI;"

There are a lot of other parameters available like Application Name, Connection Timeout, Pooling, Max Pool Size, etc. which can be included in the Connection String as per requirements.


Posted By: eTechPlanet


Date: 2 December 2009 12:23:20 AM
Post a better Answer if you have
 
(Will show your Gravatar icon)  
  Country flag

Loading
Enter the text as shown in the image dsW1Nq
Related Questions
ADO.Net : Can you serialize dataset instance?

Can you serialize dataset instance?

yes
Category: ADO.Net Date: 10/13/2010 11:37:48 PM
ADO.Net : Can you define relations in data set?

Can you define relations in data set?

Yes
Category: ADO.Net Date: 10/13/2010 10:45:47 PM
ADO.Net : Can you reuse an exisiting open ADO.NET connection with LINQ to SQL?
ADO.Net : To what type ntext type will be mapped in c# code?

To what type ntext type will be mapped in c# code?

SqlTypes.SqlString
Category: ADO.Net Date: 10/13/2010 8:08:47 PM
ADO.Net : Does Recordset exists in ADO.NET?

Does Recordset exists in ADO.NET?

No
Category: ADO.Net Date: 10/13/2010 7:15:48 PM