Reputation: 1253
I have a Database file added to my solution:
But when I try to add a connection I get the above error:
Different error when using localhost:
Error when using '.' as server name
I have added the entity framework to the solution via Nuget and have the following installed:
And Sql express does seem to be running as well.
Any Ideas on why I'm getting this error or how to solve it?
Upvotes: 1
Views: 1244
Reputation: 1157
Try using just "." (without quotes) as server name. This should represent your local sqlexpress instance
EDIT:
I believe that you need to import your MDF into your local SQL Instance rather then add this to your project. If you wanted to create an embedded Database the file extension would be SDF not MDF.
you can do this by adding the mdf file to the folder
C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\DATA
and then attach the database inside of SQL Management Studio
Or use SQL Import
Upvotes: 0
Reputation: 10430
Basically the standard connection string for sql server is:
Server=<ADDRESS>\<INSTANCE>;Initial Catalog=<DATABASE>;User ID=<USER>;Password=<PASS>;
So, if you look at this, the issue you are having right now is with the address\instance
part of this. The default settings here are for the server address to be "localhost" and for the instance name to be either "sqlexpress" or just blank (no instance name, which means you don't need the slash after the server address). If you aren't sure how you installed this you can find your instance name by following these instructions: http://social.msdn.microsoft.com/Forums/en-US/bb7ce542-be81-436a-bcd0-e6590f7ea003/instance-names-of-the-sql-server-?forum=sqlkjmanageability.
Best of luck!
Upvotes: 0
Reputation: 5909
It looks like you've forgotten the slash in your server name.
You have (localdb)v11.0
. Please try (localdb)\v11.0
instead.
Upvotes: 1