Hi guys,
I know setting up a connection string is a simple deal as all of us do daily. Have anyone came across with issue of setting up connection with a local server and using windows authentication. May yes and may be no. Whatever lets see what is the correct way of defining connection string for local database with windows authentication.
You will need to know following components as prerequisites ,
Then setup the connection string as per below given format,
<add name="NothwindDb" connectionString="data source=<Your Data Source>;initial catalog=<Your Database Name>;persist security info=True;Integrated Security=SSPI;" providerName="System.Data.SqlClient"/>
Eg : <add name="NothwindDb" connectionString="data source=Home-ISURI\SQLEXPRESS;initial catalog=Backup2015Nov26;persist security info=True;Integrated Security=SSPI;" providerName="System.Data.SqlClient"/>
I know setting up a connection string is a simple deal as all of us do daily. Have anyone came across with issue of setting up connection with a local server and using windows authentication. May yes and may be no. Whatever lets see what is the correct way of defining connection string for local database with windows authentication.
You will need to know following components as prerequisites ,
- Data Source : Server name.
- Initial Catalog : Database name.
Then setup the connection string as per below given format,
<add name="NothwindDb" connectionString="data source=<Your Data Source>;initial catalog=<Your Database Name>;persist security info=True;Integrated Security=SSPI;" providerName="System.Data.SqlClient"/>
Eg : <add name="NothwindDb" connectionString="data source=Home-ISURI\SQLEXPRESS;initial catalog=Backup2015Nov26;persist security info=True;Integrated Security=SSPI;" providerName="System.Data.SqlClient"/>
Comments
Post a Comment