.mdf file added in VS2008

Last post 06-09-2009 8:51 AM by voldy2. 4 replies.

Sort Posts:

  • .mdf file added in VS2008

    06-08-2009, 10:28 AM
    • Member
      4 point Member
    • voldy2
    • Member since 01-18-2009, 10:11 AM
    • Posts 7

    Hi

    I have VS2008 and SQL server 2008. I add a new SQL DB in Solution Explorer and it creates the .mdb file. I now want to add the membership and roles tables to this db. So I open SQL Server attach the db and then run aspnet_regsql to add the membership and roles tables. Then I detatch it and then try to open it back up in VS2008 and I'm getting errors and it won't allow me to open it: 'cannot be opened because it is version 655. This server supports version 612 and earlier. A downgrade path is not supported....

     I've been on this for 2 days now and can't find any solution any ideas guys.

     Cheers

    Nigel

    Filed under: , ,
  • Re: .mdf file added in VS2008

    06-09-2009, 3:00 AM
    • Member
      163 point Member
    • sadeed
    • Member since 11-15-2007, 2:49 PM
    • Karachi
    • Posts 142

    Hi, i feel you should look into this........

    http://conceptdev.blogspot.com/2009/04/mdf-cannot-be-opened-because-it-is.html

    The database 'C:\SOME\FOLDER\MYDATABASE.MDF' cannot be opened because it is version 655. This server supports version 612 and earlier. A downgrade path is not supported.

    Background

    I had created that database in Visual Studio 2008 (File → Add New Item → SQL Server Database) and now it wouldn't let me open it!

    What I had done is opened, edited and closed the database file using SQL Server 2008 Management Studio. Shouldn't be a problem, right, since I'm also using Visual Studio 2008?

    The Problem

    Well, although I currently have SQL Server 2008 installed, I also have SQL Server 2005 (which was installed with Visual Studio 2008 originally). When I created the database originally I just assumed it was a SQL Server 2008 database - but it wasn't (it was 2005)!

    Turns out that when you are create or open a file-based (.MDF) database (as opposed to using a database instance or server connection) Visual Studio needs some 'help' knowing what tools to use.

    When I edited the *.MDF file in SQL Server 2008, it made some fundamental "changes" to the file (even though I didn't 'upgrade' it) which prevented SQL Server 2005 from opening it. Why was Visual Studio 2008 confused? It's a configuration setting!

    To fix the problem, go to Tools → Options... → Database Tools → Data Connections and change the SQL Server Instance Name from whatever it was (probably a SQL Server 2005 instance) to your SQL Server 2008 instance, hit OK and you should be fine!




     

    If problem is still there then do let us know.......

    Remember to click “Mark as Answer” on the post If you get answer from this post(s) !

    Thanks Guys

    Regards

    Sid
  • Re: .mdf file added in VS2008

    06-09-2009, 3:14 AM
    • Member
      4 point Member
    • voldy2
    • Member since 01-18-2009, 10:11 AM
    • Posts 7

     Hi there

     I tried that and I then get "Connections to SQL server files (*.mdf) requires SQL Server Express 2005 to function properly.

     I've just found this article on msdn that suggests there is currently no support in VS2008 for SQL Server 2008 this way and that you have to do a connection in the web.config file. Is this how you read it.

    http://msdn.microsoft.com/en-us/library/cc440724.aspx

    Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}

     Cheers

    Nigel

  • Re: .mdf file added in VS2008

    06-09-2009, 7:14 AM
    • Member
      163 point Member
    • sadeed
    • Member since 11-15-2007, 2:49 PM
    • Karachi
    • Posts 142

    There is nothing such like VS 2008 not compating SQl 2008.......you have a lower and upper version conflict........By that I mean

    655 version means Sql server 2008

    612 means Sql server 2005

    As you have mentioned it worked well when you first installed that mean some where SQL Server 2005 is creating a problem for you......

    Simply remove the SQL Server 2005 or simply stick to one version you will find your problem resolved.....Try this and if problem is there then do let us know.......

    Remember to click “Mark as Answer” on the post If you get answer from this post(s) !

    Thanks Guys

    Regards

    Sid
  • Re: .mdf file added in VS2008

    06-09-2009, 8:51 AM
    Answer
    • Member
      4 point Member
    • voldy2
    • Member since 01-18-2009, 10:11 AM
    • Posts 7

     Actually I have resolved this. There is no conflict in the way you mean. Okay here goes:

     When you install VS2008 it also installs SQL Server 2005 Express Edition this is to enable you add a database through the app_data folder so you can then use the friendly interface ASP.NET configuration tool. 

    At the moment VS2008 does not support this method of adding a db this way, however Microsoft are releasing an update in the next few months.

    So if you want to use VS2008 with SQL Server 2008 and add the 'Membership, roles, user' component tables to one database you must first do it in SQL Server 2008. Then you create a connection string through the web.config file to your database.

     

    Cheers

    Nigel

Page 1 of 1 (5 items)