Ok, I come from the Open Source world where the "configuration" does not seem anywhere near this bizarre. I've been given a "mdf" database file. I am working with Visual Studio 2013 and all I want to do right now is simply bring up the dadgum page in Page Inspector or in the browser -- which I was able to do when I was connected to a "real" database in the office. But now I'm remote and need to work with this "file". I have put it in the "data folder of my project; I have put it in a folder in My Documents path; I have put it in Program Files path for MS SQl Server. The next place I'm going to put it is in the garbage unless I can find out how this "project" in Visual Studio 2013 is looking for a database. My "web.config" file has this:
<add name="DefaultConnection" connectionString="Data Source=WS-xxxx;Initial Catalog=blahblahblah;MultipleActiveResultSets=True;Integrated Security=false;AttachDBFilename=|DataDirectory|blahblahblah.mdf;User Id=xxxxx;Password=yyyyy" providerName="System.Data.SqlClient" />
I've also tried:
<add name="DefaultConnection" connectionString="Data Source=WS-xxxx;Initial Catalog=blahblahblah;MultipleActiveResultSets=True;Integrated Security=false;AttachDBFilename=[C:\Users\MyName\My Documents\Test Database\blahblahblah.mdf;User Id=xxxxx;Password=yyyyy" providerName="System.Data.SqlClient" />
...and this:
<add name="DefaultConnection" connectionString="Data Source=WS-xxxx;Initial Catalog=blahblahblah;MultipleActiveResultSets=True;Integrated Security=false;User Id=xxxxx;Password=yyyyy" providerName="System.Data.SqlClient" />
Nothing else seems to make much sense. I'd appreciate any (valid) advice on why this is happening -- I was hoping to be coding in C# at this point, not fighting with MS Configuration stuff. As info, I CAN see the database in both Server Explorer and SQL Server Object Explorer in the VS Studio. I can also query it IN THE STUDIO and get valid results. And it's at the path that I specified in the "My Documents" folder. So it boggles my mind that I have put all these various paths in this web.config file and the Studio still says it can't find it when I bring up Page Inspector. Thanks.
This is the error I keep getting, regardless of where I put this database:
The system cannot find the file specified Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ComponentModel.Win32Exception: The system cannot find the file specified
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[Win32Exception (0x80004005): The system cannot find the file specified]
[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]