I've being trying to get started with Beginning ASP.NET MVC 4.
And hit a problem straight away, according to the e-book I should be able to start a new mvc 4 internet application, debug and select log-in form the UI tempate, then stop. This should create the mdf file in the App_Data folder. Which I should be able to click on and open in Server Explorer.
What actually happens - Database get created in my SQL Express.
Getting this step correct is crucial to following the rest of the tutorial.
I am familiar with MVC , but mainly the front end stuff, so I'm trying to increase my understanding of the database/models side of MVC.
This is a completely new project, no changes were made, just out of the box code. On a windows XP machine, using Visual Studio 2010.
Connectionstring -
<add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-HaveYouSeenMe-20131125091100;Integrated Security=SSPI" providerName="System.Data.SqlClient" />
Can anyone please explain - why my out of the box connectionstring is creating the Db in SQL Express and how to create the mdf in the App_Data folder as book suggests. cheers.
Default Location of MDF File in SQL Server Files that are common and used by all instances on a single system are installed inside the folder :\Program Files\Microsoft SQL Server\nnn\.
Since MDF files are SQL server Database files which are basically log files, hence there really is no way to open them. The only way is to attach them. As soon as you attach them, you can see its database in object explorer of SQL Server Management Studio(SSMS).
The AppData folder includes application settings, files, and data unique to the applications on your Windows PC. The folder is hidden by default in Windows File Explorer and has three hidden sub-folders: Local, LocalLow, and Roaming. You won't use this folder very often, but this is where your important files reside.
I know this says answered, but it may be as simple as clicking the "show all files" icon in the Solution Explorer. By default the .mdf file will not show up, so ensure the "show all files" is selected :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With