c# - What providerName and connectionStrings should be used for MS SQL Compact Edition in MVC 4 in Visual Studio 2013 in ASP.NET MVC 4? -
what providername should used in web.config file ms sql compact edition in mvc 4 in visual studio 2013?
introduction when use:
<connectionstrings> <add name="musicstoreentities" connectionstring="data source=|datadirectory|mvcmusicstore.sdf" providername="system.data.sqlserverce.4.0"/> </connectionstrings> my website database works , genre objects retrieved database , displayed
after alter of providername providername="system.data.sqlclient this:
<connectionstrings> <add name="musicstoreentities" connectionstring="data source=|datadirectory|mvcmusicstore.sdf" providername=providername="system.data.sqlclient"/> </connectionstrings> i get:
so why want alter anything?actual problem: if leave providername="system.data.sqlserverce.4.0" when want add together new controller menu:
i get:
but if set providername="system.data.sqlclient storemanagercontroller generated database not work @ all.
question: should generate storemanagercontroller? follow tutorial: http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-5 , link working project before step it: http://www.speedyshare.com/rgdqh/mvcmusicstore.zip
so bare in mind "mvc music store" mvc 101 since origin of mvc. given there have been lot of changes, chances of documentation/walk-throughts beingness little off unfavorable. said:
the t4 template data-driven controller failing due connection string. because sql express (in of itself) has gone through lot of cycles , next localdb. given you're using mvc4, it's time upgrade, , means can have benefits of sql express (including system.data.sqlclient provider) without possible headaches previous revisions.
with said, alter connection string utilize new format:
<connectionstrings> <add name="musicstoreentities" connectionstring="data source=(localdb)\v11.0;integrated security=true;attachdbfilename=|datadirectory|mvcmusicstore.mdf" providername="system.data.sqlclient" /> </connectionstrings> and (probably) re-run databaseinitializer (if recall correctly, should happen automatically since it's using ef. if not, can go bundle manager console , run update-database).
this gives provider controller template wants while still keeping local (dev) database.
c# sql asp.net-mvc asp.net-mvc-4 visual-studio-2013
No comments:
Post a Comment