0

How do I have to configure my SQL Server Express connection string that the server attribute accepts the computername where the SQL Server is running aka the current machine:

<connectionStrings>
    <add name="MyDbConn1" 
         connectionString="Server=.\SQLEXPRESS;Database=MyDb;Trusted_Connection=Yes;"/>       
</connectionStrings>

I have seen somewhere a configuration like the above where the server attribute has the .\SQLEXPRESS value.

What does that dot notation mean?

marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425
Elisabeth
  • 19,392
  • 50
  • 192
  • 316
  • The dot basically means "localhost". – Ed Gibbs Sep 11 '15 at 15:03
  • IMO, you can refer [this question](http://stackoverflow.com/questions/20217518/sql-server-connection-strings-dot-or-local-or-localdb) for more information :) – BNK Sep 11 '15 at 15:15

1 Answers1

0
<connectionStrings>
  <add name="MyDbConn1" connectionString="Server=localhost;Database=MyDb;Trusted_Connection=Yes;"/>       
</connectionStrings>

If it is a named instance with a different name than "SQLEXPRESS" or the SQL instance is exposed on a port other than 1433, you will have to change that in the connection string as well. Typically, if there is only one SQL instance, Server=localhost will totally suffice.

Does it not work, simply by referencing localhost or 127.0.0.1.

If not, you may have to go to SQL Server Configuration Manager, navigate to TCP/IP, click the IP addresses tab and enable 127.0.0.1.

Also, I think it is Trusted Connection=True not Trusted Connection=Yes, but maybe that works...?