none
Visual Studio 2010 and SQL Server Express 2008 R2

    Question

  • Hi smart people,

    Would you please help me with the following issue?

    I have SQL Server 2008 R2 Express Edition installed on my local PC.  Then, I installed Visual Studio 2010 Professional edition on the same local PC.  Now for my project, I created in Visual Studio a form into which I need to bind a Server-Based Database.  Here are the steps I have taken within Visual Studio to accomplish this: 1) Right click on project name 2) Select "Add ---> New Item..." from pop-up menu 3) Choose "Service-Based Database" from Add New Item window 4) Click on "Add" button.  Immediatly I receive this error message: "Connections to SQL Server database files (.mdf) require SQL Server 2005 Express or SQL Server 2008 Express to be installed and running on the local computer. The current version of SQL Server Express can be downloaded at the following URL: http://go.microsoft.com/fwlink/?LinkId=125883".

    According to some documentations on MSDN, once I have SQL Server Express 2005 or later installed on my local machine, Visual Studio should not throw this error message.  Since I am running SQL Server 2008 R2 Express Edition, which is a later version than SQL Server 2005, I cannot pinpoint the problem.  What should I do in this case? Would you please provide me with a solution?

    Thank you!
    JRoumain

    Monday, December 26, 2011 7:18 PM

Answers

  • Hi Bob,

    How are you doing? After being silent for a long time due to other projects at work, I am jotting you these lines just to let you know that I finally found a solution to the problem.  Here is what I did:

    Because I had initially installed MS SQL Server 2008 R2 Express Edition before I installed MS Visual Studio 2010 Developer Edition, the instance name of the MS SQL Server defaulted to "MSSQLSERVER".  Later on, when I went ahead to install MS Visual Studio 2010, I did a custom installation where I unchecked the option to install MS SQL Server since I already had one instance running on my machine.  But as it turned out to be, Visual Studio was not too happy with that since it refused to allow a connection to the instance of MS SQL Server even though I provided the correct instance name "MSSQLSERVER" to Visual Studio by following the steps you gave me.  So I just had to re-install
    MS Visual Studio while I left the option to install MS SQL Server checked.  And this time around, Visual Studio creates a second instance with the built-in name "SQLSERVEREXPRESS".  This is the instance Visual Studio recognizes.

    I also seize this opportunity to thank you for you time in helping me.  I really appreciate it.  Thank you!

    JRoumain   


    yvesalbert8

    Thursday, February 23, 2012 1:29 AM

All replies

  • Hi JRoumain,
    This error message could be caused by many reasons.
    In general, the exception has the following causes: 
    There is no SQL Server Express installed on the machine. 
    The SQL Server Express instance is not running. 
    Incorrect instance name of SQL Server Express is specified in Visual Studio. 
    Please make sure the SQL Server Express instance is running and have the correct name.
    However, it may cause by other reason, there used to be a similar issue  when creating a Service-based database in Visual Studio 2008 SP1,formore details, see FAQ: Error creating a Service-based database in Visual Studio 2008 SP1
    So could you provide more information?
    What’s your Operating System?
    What’s the version of Visual Studio 2010 Professional edition (get the version number from help->About Microsoft Visual Studio)?
    What’s the version of SQL Server 2008 R2 Express Edition (32bit or 64 bit)?
    Could you reproduce this issue on other machine?
    Best Regards,

    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us
    Wednesday, December 28, 2011 10:19 AM
    Moderator
  • Hi Bob,

    Happy new year!  Thank you for taking the time to reply to my post. Here are the answers to the questions you asked me:

    Operating System: Windows XP (32-bit OS)
    Version of Visual Studio 2010 Professional Edition: Version 10.0.30319.1 RTMRel
    Version of SQL Server 2008 R2 Express Edition: 32-bit

    I have these two programs installed on one machine, the same computer.  I know for sure that SQL Server Express 2008 R2 is installed properly and that the instance is running well because I have been able to accomplish other tasks, such as creating databases, tables, stored procedures, and so on.  The only problem is what I mentioned in my previous post and this error is raised only within MS Visual Studio.  Therefore, as a first step to try to solve this issue, could you please tell me how I can verify if the correct instance name of SQL Server Express is specified in Visual Studio?

    In the meantime, I am hoping to receive other suggestions on fixing this problem.

    Thank you!


    yvesalbert8
    Sunday, January 08, 2012 5:28 AM
  • Hi JRoumain,
    Happy New Year!
    What’s the name of your SQL Server instance? If it is SQLEXPRESS, then it’s correct. Otherwise, you need to change the SQL Server Instance Name to your instance name in visual studio (Tools -> Options -> Database Tools -> Data Connections).
    Here is a similar issue which is caused by incorrect instance name, see http://social.msdn.microsoft.com/Forums/da-DK/vstsdb/thread/b987cf66-4afe-47a4-9529-e3cccce87554.
    In addition, I can’t find other reasons may cause this issue currently, if this is not help, I suggest you send a feedback to Microsoft Connect.
    Anyway, please tell me the result after you test.
    Best Regards,

    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us
    Monday, January 09, 2012 9:21 AM
    Moderator
  • Hi Bob,

    First, thank you for following up with me on my issue with SQL Server 2008 R2 Express Edition and Visual Studio 2010 Professional Edition.  I have been silent for a while because I have been working on other projects lately.  However, I still need your help, and other people's, for the problem still lingers.

    I went ahead and followed your instruction, which consisted in changing the SQL Server Instance Name from within Visual Studio. Here is what I did: From Visual Studio --> Tools --> Options --> Database Tools --> Data Connections, I changed the Instance Name from "SQLEXPRESS" to "MSSQLSERVER" since it is the default name of my SQL Server instance. After making this change, I tried to bind Server-Based Database to my form again (please refer to my first post on top of this page to read about the exact steps).  Here is the new error message that pops up:

    "LOCAL DATABASE FILE

    A network-related or instance-specific error occurred while establishing a connectionn to SQL Server.  The server was not found or was not accessible.  Verify that the instance name is correct and that SQL Server is configured to allow remote connections.  (provider: SQL Network Interfaces, error: 25-Connection String is not valid"

    What I do not understand is that both SQL Express and Visual Studio are installed on my local PC.  I also went to the SQL Server Management Studio to configure the instance for remote connection. Here are the steps I took: (From SQL Server Management Studio --> Right click on server name --> Facets --> Surface Area Configuration --> AdHocRemoteQueriesEnabled --> Select "True" from drop-down. 

    The problem still persists.  What would you advise me? Any idea? It is urgent.

    Thank you again for your time!

    JRoumain


    yvesalbert8
    Thursday, January 26, 2012 10:04 PM
  • Hi JRoumain,
    I'm sorry that I can't find any other possible reason.
    I suggest you create a new thread in the Visual Studio Forums or SQL Server Forums for better support.
    Sorry for any inconvenience this may cause.
    Best regards,

    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us
    Friday, January 27, 2012 6:54 AM
    Moderator
  • Hi Bob,

    How are you doing? After being silent for a long time due to other projects at work, I am jotting you these lines just to let you know that I finally found a solution to the problem.  Here is what I did:

    Because I had initially installed MS SQL Server 2008 R2 Express Edition before I installed MS Visual Studio 2010 Developer Edition, the instance name of the MS SQL Server defaulted to "MSSQLSERVER".  Later on, when I went ahead to install MS Visual Studio 2010, I did a custom installation where I unchecked the option to install MS SQL Server since I already had one instance running on my machine.  But as it turned out to be, Visual Studio was not too happy with that since it refused to allow a connection to the instance of MS SQL Server even though I provided the correct instance name "MSSQLSERVER" to Visual Studio by following the steps you gave me.  So I just had to re-install
    MS Visual Studio while I left the option to install MS SQL Server checked.  And this time around, Visual Studio creates a second instance with the built-in name "SQLSERVEREXPRESS".  This is the instance Visual Studio recognizes.

    I also seize this opportunity to thank you for you time in helping me.  I really appreciate it.  Thank you!

    JRoumain   


    yvesalbert8

    Thursday, February 23, 2012 1:29 AM
  • Hi JRoumain,
    I’m glad to hear that you solved it. This information is very helpful and thank you for share it with us.
    Have a nice day.

    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us

    Friday, February 24, 2012 8:22 AM
    Moderator