Last post Feb 16, 2015 08:07 AM by Michelle Ge - MSFT
Feb 12, 2015 10:24 PM|nthnu|LINK
I was following steps in these pages (http://www.asp.net/web-pages/overview), and greatly enjoy programming with Razor, and for the CRUD pages it uses a local SDF db. I'd like to tinker by using an MDF
db. Are there any easy to follow steps like the link to use MDF dbs?
Feb 13, 2015 12:53 AM|jsiahaan|LINK
You only need to change connectionString to change from .sdf to .mdf.
You can post your connectionString here. Copy it from web.config at the root folder of your project.
Feb 16, 2015 08:07 AM|Michelle Ge - MSFT|LINK
According to your description, you want to connect the local DataBase file. So far as know, you only need to set your mdf file path into the connectionstring of the web.config file.
Please refer to the code below:
add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
Hope it's useful for you.