Databases?

Sep 3, 2011 at 3:02 PM

I opened a couple of issues then decided I should try to figure out the problems myself so I downloaded the code from build 69520.  I ran into a database problem.

First, when I run the application it gives an error "Unable to complete operation. The supplied SqlConnection does not specify an initial catalog." 
There isn't a nerddinnder.mdf in the App_Data directory; the name in the Solution Explorer has an exclamation point on it.  

Second, the aspnetdb.mdf has a red X on it in Server Explorer and when I try to open it I get an error "...ASPNETDB.MDF cannot be opened because it is version 661.  This server support version 662 and earlier.  A downgrade path is not supported. Could not open new database ....ASPNETDB.MDF. Create databse is aborted...."

It appears that I'm doing something dumb. 
Any suggestions other than to sit on my hands?

Visual Studio 2010 SP 1 (tried running as administrator)
Win 7 64-bit
SQL Server Express 2008 R2
SQL Server Compact 4.0

Thanks.

Sep 6, 2011 at 11:37 AM

I think the problem with the apsnetdb might have to do with my SQL Server installation.  It looks like the 2008 and 2008 R2 installs somehow got messed up.  I'm working on reinstalling 2008 R2.  I'm still not sure about the nerddinner.mdf.  Am I supposed to manually build that?  If so, where would I find the instructions?  Thanks.

Coordinator
Sep 6, 2011 at 11:54 AM

After checking the repository, the NerdDinner.mdf is in the App_Data directory. Can you try syncing up to the source again?

Sep 7, 2011 at 10:04 PM
Edited Sep 7, 2011 at 10:13 PM

I got the same error... I think I need to upgrade SQL Server from R2 to SP2?

Coordinator
Sep 7, 2011 at 11:38 PM
Edited Sep 8, 2011 at 12:00 AM

Okay, I've done some research here and I think I know what’s going on.

First, both of the MDF files should get pulled down with the source. If they aren't in the App_Data directory, please try to download them again from the source repository. It's not necessary to explicitly attach these MDF files to the SQL Express instance. The connection string specifies ‘User Instance’ and ‘AttachDBFilename’ properties which spin up a runtime-initiated instance of the MDF file.

Next, If you're getting this error:

"The database 'NERDDINNER.MDF' cannot be opened because it is version 661. This server supports version 662 and earlier. A downgrade path is not supported.Could not open new database 'NERDDINNER.MDF'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 948)"

You have SQL Express 2008 SP2 installed and not SQL Express 2008 R2. Really the way this error should read is:

"The database cannot be opened because it is version 661. This server supports versions 662, 655 and earlier than 655. A downgrade path is not supported."

My understanding is that  SQL Server 2008 SP2 and SQL Server 2008 R2 databases are not interchangeable because a feature introduced in SP2. Part of the confusion, for me, is with the version numbers. R2 is the 'latest and greatest', but has a lower data format version #. Here's a table of the various versions of SQL Server 2008 and their data format version #s.
•    SQL Server 2008 R2 (v 10.50.1600) data format version # 661
•    SQL Server 2008 SP2 (v 10.00.400) data format version #662
•    SQL Server 2008 (v 10.00.1600) data format version #655

The MDF files included in the Nerd Dinner source are from SQL Express 2008 R2. If you find that you don't have R2 installed there are two ways of remedying this scenario, first would to be to upgrade the SP2 instance to R2. Or you could manually build out the DB on SP2, in which case you would need to build some mechanism of importing the schema.

PS. Here a link to my blog post on this subject along with the SQL Schema scripts for building your own DBs.

Sep 8, 2011 at 4:47 AM

I get the "... version 661 ... " error, and I have SQL Server 2008 R2, which I confirmed in "Help - About" in SSMS. So your line above, "You have SQL Express 2008 SP2 installed and not SQL Express 2008 R2.", can't be correct. I thought I might need to install SP2 because SP2 was just published 8/22/2011 which is after I installed SQL Server 2008, but it won't install. The error says there is not an instance of SQL Server that can be updated. So I considered uninstalling SQL Server and getting SQL Server 2008 SP2 from msdn, but there are only R2 versions. Will try building the db using the scripts in the link above. Thanks!!

Sep 8, 2011 at 12:11 PM

epkrause,

My SQL Server version said that I had R2 installed as well. However, something was obviously not right with it.

I ended up having to uninstall everything that was related to SQL Server under Add/Remove programs then download the R2 Express setup and reinstall it.  I *think* I originally installed SQL server R2 using the web platform installer and wonder if that didn't work completely; however, I don't exactly remember how I installed the full SQL Server.

Just as a note - when I reinstalled R2 I did have problems.  I've installed SQL Server numerous times with the main setup before without issues... so I'm not sure what happened this time - except maybe the web platform installer thing.  If you have errors showing drive/folders with "e:\...." then make sure you are running as administrator. Not only logged in as admin but right-click and "Run as Administrator" on the setup.

I'm still not able to run the solution, but at least I'm not getting the "version 661" error.  I'll post back once I get it working.

Coordinator
Sep 8, 2011 at 1:20 PM

I'm still looking into this. Did either of you upgrade SQL Express to R2 from a previous version or was this a clean install? Also, are there any other SQL instances running on these machines?

Sep 8, 2011 at 2:52 PM
Edited Sep 8, 2011 at 2:54 PM

I got the app running by creating the nerddinner db from the script provided by pmourfield in my SQL Server R2 instance and then changed the connection string. Plus I had to replace the ASPNETDB.mdf file that came with the NerdDinner download with another one I had for another project before the app would run. Now I can create a dinner and save and edit it. There were some odd hard coded paths in both .mdf files' properties (the .mdf files downloaded with the project), such as in the name property, that are left over from someone else's installation, so I'm wondering if that might be part of the problem?

I'm still having database issues in that when I search for nearby dinners I get an error: "Cannot find either column "dbo" or the user-defined function or aggregate "dbo.DistanceBetween, or the name is ambiguous." The DistanceBetween function does exist in the NerdDinner db. Must be a permissions thing... Anyway, most of it runs! :)

pmourfield, I did upgrade SQL Express R2 from a previous version, and I do not have any other instances of SQL running. thunderhelper, thanks for your thoughts about the SQL re-installation.

 

Sep 8, 2011 at 5:57 PM

I did a clean install.  No other instances running on my machine.

Sep 9, 2011 at 1:55 AM

Whew.  I was finally able to run the site on my PC.

I may be doing something dumb so please let me know if I am. 

First, I'm using the code from the Trunk folder.  Is that right?

Next I had to:
"Show all files" in the NerdDinner project and manually add the two databases aspnetdb.MDF and NerdDinner.mdf files to the project.
Update the connection strings in both the connectionStrings.config and Web.config files to point to my database.  Replace ".\SQLEXPRESS" with "COMPUTERNAME\SQLEXPRESS2008".
Add the "Initial Catalog=nerddinner;" parameter to the connection string in both files.
Add the "Initial Catalog=aspnetdb;" parameter to the connection string in both files.
Had to delete the aspnetdb_log.LDF file from the directory.

After those changes, it compiles and starts!

Oct 24, 2011 at 6:47 AM
pmourfield wrote:
PS. Here a link to my blog post on this subject along with the SQL Schema scripts for building your own DBs.

The domain name in this link is expired. Is the script available somewhere else?

 

Nov 20, 2011 at 10:13 AM
Edited Nov 20, 2011 at 10:20 AM

I have installaed Service Pack 3 on my SQL Server 2008. I verify that SP2 is better, as suggested before.

The Nerd Dinner MVC 2 is working well and I can debug the code.

The NerdDinner MVC 3 in not running because of problem of database previously suggested.  The solution builds successfully, but the NerdDinner.mdf is missing in app_data.

If I try to restore another nerddinner.mdf, but I have the #661 error as before written.

PS. Here a link to my blog post on this subject along with the SQL Schema scripts for building your own DBs.

The domain name in this link is expired. Is the script available somewhere else?

 I confirm this problem, it is not possibile to find the script to create nerddinner.mdf. Can you verify the link and post the script to create the database rightly ?

Nov 20, 2011 at 10:23 AM
Edited Nov 20, 2011 at 10:38 AM

In the last download of MVC3 the Database nerdDinner.mdf is missing in project,

the status is not stable, absolutely not !!

I can improve MVC with NerdDinner 2, Regards !