I have been able to connect to my database, but I still get an error message.
- In server explorer (view > server explorer) click on the connect to database button.
- Data Source: Microsoft SQL Server (SqlClient)
- Server Name: (LocalDB)\v11.0
- Attach a database file: path to mdf file
- Test Connection
- OK (if test connection succeeded)
After all these steps I have the green icon on my database icon in Server Explorer.
Now you can right click on database and choose properties, then you select the connectionstring and paste it in the Webconfig file.
When I press F5 on my Default.aspx file, I still get the error message:
Sql exception was unhandled by user code
An attempt to attach an auto-named database for file C:\(path to file) failed.
A database with the same name exists, or specified file cannot be opened,
or it is located on UNC share.
I get the error message in the file CategoriesBLL.cs at the line
return Adapter.GetCategories();