Connect C# Application with Sql

Connection string to connect with sql in c#:
1.
If you want to connect with Windows Authetication then use below string:

string connecting="data source=YOUR_SERVER_NAME;initial catalog=YOUR_DATABASE_NAME;integrated security=true";
SqlCOnnection con=new Sqlconnection(connecting);
con.Open();

//Integrated security used to connect using windows authetication.

2nd Method:
if you want to connect with user id and password use below string:

string connecting="data source=YOUR_SERVER_NAME;initial catalog=YOUR_DATABASE_NAME;user id=user_name;password=server_password";
SqlCOnnection con=new Sqlconnection(connecting);
con.Open();

user id parameter used to specify user name to connect with sql server.

If we want pooling to be true then we should also add a parameter in connection string that is :
pooling=true

Note:for more information contact
Thnak you
Ebook Download
View all
Learn
View all