Connection Strings

This will work if you are using Entity Framework to connect with sql server.

Use following settings while you have Windows Auth\Integrated Security setup (I recommend this, even in prod). Data Source is dot(.) for local as shortcut otherwise you have to provide machine name.

<connectionStrings> 
<add name="[DbName]" connectionString="Data Source=.;Initial Catalog=[SQL-SRVR-DB-NAME];Integrated Security=true;Persist Security Info=False;MultipleActiveResultSets=True" providerName="sqlserver" />
</connectionStrings>

 

Using Sql Server Authentication -

<connectionStrings> 
<add name="[DbName]" connectionString="Data Source=.;Initial Catalog=[SQL-SRVR-DB-NAME];Uid=[USER-ID];Pwd=[PASSWORD];Persist Security Info=False;MultipleActiveResultSets=True" providerName="sqlserver" />
</connectionStrings>


Connecting with a named instance -

<connectionStrings> 
<add name="[DbName]" connectionString="Data Source=.\[INSTANCE-NAME];Initial Catalog=[SQL-SRVR-DB-NAME];Integrated Security=true;Persist Security Info=False;MultipleActiveResultSets=True" providerName="sqlserver" />
</connectionStrings>

 

Add comment