Answered Fresh install of VS2010 can't see SQLEXPRESS

  • Thursday, April 29, 2010 11:17 AM
     
     

    Windows 7 Pro.
    VS2008 pro installed and working OK
    SQL server 2008 web installed and working OK
    SQL server 2008 R2 Express installed and working

    I installed VS2010 - downloaded as part of the Websitespark program.
    it installed OK, runs and will create new projects.

    Created a new project - Web Application MVC2
    Then with out changing anything, compile and debug - all looks OK, click login, click register ( as no users yet )
    fill in the form, click submit - I get a run time exception...
    "HTTPException was unhandled by user code"
    "Unable to connect to SQL Server database"

    if I open a project that I know has the database already created ( from before the problem happened )
    I get the following error

    "Failed to generate a user instance of SQL server due to a failure in starting the process for the user instance.
    the connection will be closed"

    If I try to connect to SQLEXPRESS in VS2010 IDE using Server Explorer
    using Data Connections > new >  SQLEXPRESS does not show up on the list

    there is a copy of SQLEXPRESS that I can connect to in SQL Server Manager.
    it is called MYCOMPUTER\SQLEXPRESS


    I have tried the following - none of which made any difference:

    1:
    I tried renaming the connection in VS2010 IDE
    as suggested here
    http://social.msdn.microsoft.com/Forums/en-US/linqtosql/thread/19630e41-e460-482c-b43a-edeec29f251c

    which suggests the following
    In Visual Studio, go to Tools -> Options -> Database Tools -> Database Connections,
    fill the SQL Server Instance Name with the name of SQL Server 2008 Express instance.

    It makes no difference SQLEXPRESS still does not show in list in VS2010 IDE server explorer.

    DID NOT WORK

    2:
    I also did this from the same thread:
    Delete the directory “c:\Users\<username>\AppData\Local\Microsoft\Microsoft Sql Server Data\SQLEXPRESS”
    This folder's used to store information and apparently it messes up the proper working of SQL Express.

    Reboot the system

    DID NOT WORK

    3:
    setting tcp and named pipes on in SQL server config manager :

    DID NOT WORK

    I hope there is someone out there who knows waht the answer is....

    Thanks Tim

All Replies

  • Friday, April 30, 2010 9:11 AM
    Moderator
     
     

    Hi Tim,

    Thank you for your post.

    This forum is for the support of Visual Studio installation. Since your issue is related to the data connection of ASP.NET project, you could post your thread on ASP.NET Forum. This will make answer searching in the forum easier and be beneficial to other community members as well.

    Thank you for your understanding!

    Have a nice day.

    Best regards,
    Yichun Chen
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.

  • Sunday, May 02, 2010 8:11 AM
     
     Answered

    @Yichun Chen

    Thanks for the reply. I understand that the issue is with the data connection.

    BUT the issue only started when I installed Visual Studio 2010 for the first time !
    both my original install of VS2008 and the new install of VS2010 where affected.

    I did find a solution - thanks to the Microsoft Concierge facility.
    they had this in their database: ( thanks for finding it Joyce )

    http://www.aspdotnetfaq.com/Faq/fix-error-Failed-to-generate-a-user-instance-of-SQL-Server-due-to-a-failure-in-starting-the-process-for-the-user-instance.aspx
    Two simple things need to be done:

    Step 1. Enabling User Instances on your SQL Server installation
    First we are gonna make sure we have enabled User Instances for SQL Server installation.

    Go to Query Window in SQL Server Management Studio and type this:

    exec sp_configure 'user instances enabled', 1.
    Go
    Reconfigure

    Run this query and then restart the SQL Server.

    Step 2. Deleting old files
    Now we need to delete any old User Instances.
    Go to your C drive and find and completely DELETE this path (and all files inside):


    C:\Documents and Settings\YOUR_USERNAME\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS

    (Dont forget to replace the green text in the path with your current username (if you are not sure just go to C:\Documents and Settings\ path to figure it out).


    After deleting this dir you can go to Visual Studio, create ASP.NET WebSite and click on your App_Data folder and choose Add New Item and then choose SQL Server Database and it should work!!!

    THIS WORKED

    Hope this helps anyone else who has the same problem.

    Tim.

    • Marked As Answer by timCoupland Sunday, May 02, 2010 8:11 AM
    •  
  • Monday, May 03, 2010 2:22 AM
    Moderator
     
     
    Hi Tim,

    I'm so glad to hear that your problem is solved.

    Based on your description, your issue is related to user instance of SQL Server.

    Thank you for your kindly sharing! I really appreciate that.

    I believe that this will benefit other community members who have similar problem as you.

    Best regards,
    Yichun Chen
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Tuesday, July 06, 2010 8:59 PM
     
     

    timCoupland

    That solution was what I've been looking for, for the last month.

    IT WORKS!!

    Thank you for posting!