Skip to content
codeplanner edited this page Dec 31, 2014 · 5 revisions

In the previous step we could see that data could be stored and retrieved, but where was the database?

If you use the default LocalDByou will find the database in the App_Data directory of your since you probably have a line looking something like this in your config.

<connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-MyWebApp-20141230073530.mdf;Initial Catalog=aspnet-MyWebApp-20141230073530;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>

But if you want to use MSSQL or SQL EXPRESS (in this case) you can add this instead

<connectionStrings>
    <add name="XXX.Data.DataContext" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=XXX.Data.DataContext;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
</connectionStrings>

Note that XXX should be replaced with the root namespace of your project.

A good next step is to learn about custom validation

Clone this wiki locally