I get stuck at the end of Chapter 4

Dec 24, 2012 at 4:59 AM
Edited Dec 24, 2012 at 5:04 AM

Let me show my situation and thanks for your help.

I have install SQL Server 2008 express on my computer. But I have recognized that this tutorial is using SQL Server Compact Edition. 

So I used the following configuration in web.config file

<connectionStrings>
    <add name="MusicStoreEntities" connectionString="|DataDirectory|MvcMusicStore.mdf" providerName="System.Data.SqlClient" />
  </connectionStrings>

instead of 

<connectionStrings>
<add name="MusicStoreEntities"
connectionString="Data Source=|DataDirectory|MvcMusicStore.sdf"
providerName="System.Data.SqlServerCe.4.0"/>
</connectionStrings>

Unfortunatly, I got the exception at runtime below(Other code snippets is the same as the tutorial)

public ActionResult Index()
{
    var genres = storeDB.Genres.ToList(); //This line occurs
    return View(genres);
}

ArgumentException was unhandled by user code. 

Format of the initialization string does not conform to specification starting at index 0.

So how could I configure the web.config file to make it work? Thank you for all!

Do I need to add a MvcMusciStore.mdf file before these operations?

Dec 24, 2012 at 5:35 AM

I may fix it on two ways in this link.

But I still haven't got ideas about how it work out?

Can someone explain it in detail?

Thank you!

Dec 24, 2012 at 6:07 AM
Is installing SQL CE an option? I had to do that to work with tutorial.

The built in account database in the MVD 2010 template (at least in MVC4 / MWD 2010) is SQL Express. I had two connection strings - one for Express and one for CE.




On Dec 23, 2012, at 11:59 PM, "sagegz" <notifications@codeplex.com> wrote:

From: sagegz

Let me show your situation and thanks for your help.

I have install SQL Server 2008 express on my computer. But I have recognized that this tutorial is using SQL Server Compact Edition.

So I used the following configuration in web.config file

<connectionStrings>
    <add name="MusicStoreEntities" connectionString="|DataDirectory|MvcMusicStore.sdf" providerName="System.Data.SqlClient" />
  </connectionStrings>

instead of

<connectionStrings>
<add name="MusicStoreEntities"
connectionString="Data Source=|DataDirectory|MvcMusicStore.sdf"
providerName="System.Data.SqlServerCe.4.0"/>
</connectionStrings>

Unfortunatly, I got the exception at runtime below(Other code snippets is the same as the tutorial)

public ActionResult Index()
{
    var genres = storeDB.Genres.ToList(); //This line occurs
    return View(genres);
}

ArgumentException was unhandled by user code.

Format of the initialization string does not conform to specification starting at index 0.

So how could I configure the web.config file to make it work? Thank you for all!

Dec 24, 2012 at 6:18 AM
3v3rhart wrote:
Is installing SQL CE an option? I had to do that to work with tutorial.
The built in account database in the MVD 2010 template (at least in MVC4 / MWD 2010) is SQL Express. I had two connection strings - one for Express and one for CE.

Hi,

Thanks for your response.

I don't quite understand your specify issues. After all I'm reading the Chapter 4. But you can try to install SQL Server Compact 4.0 to follow this tutorial.

Jan 20, 2013 at 2:28 PM

Yes the smartest thing to do is download SQL server Compact 4.0.  Then put the ddl ' files  for SQL server compact 4.0 in the bin directory of your project. (MVCMusicStore)

Then put the database MVCMusicStore.sdf which you can download from this page in your App_Data folder for you project.

Maybe you have to reboot your machine to connect to MVCMusicStore.sdf

This worked for me