locked
connection to SQL Server files (*.mdf) require SQL server express 2005 to function properly. RRS feed

  • Question

  • User-1647864282 posted

    I dont have the SQL EXPRESS installed instead I have SQL Standard Edition.

     I have two SQL Server instances installed.

     1- UserLT (this is sql 2000)
    2- UserLT\SQL2005 (this is SQL 2005 named instance)

    But when i try to add a database to my VS website project I get the following error:

    Connection to SQL Server files (*.mdf) require SQL server express 2005 to function properly. please verify the installation of the component or download from the URL: go.microsoft.com/fwlink/?linkId=4925

    I went in Tools>Opetions>DataBase tools>Data Connection>Sql Server Instance Name (blank for default)

    and changed the "SQLEXPRESS" to "USERLT\SQL2005".

    But I still get the same error message. Any ideas how i can resolve this issue?

    Sunday, June 10, 2007 12:16 PM

Answers

  • User-1136466523 posted

    Hi,

    You may open your Machine.Config file (the file is in %SystemRoot%\Microsoft.NET\Framework\ver. number\CONFIG ). Try to find the ConnectionString node, modify the setting and make it look like

    <add name="LocalSqlServer" connectionString="data source=UserLT\SQL2005;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />

    Thanks.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 12, 2007 5:16 AM

All replies

  • User1873438307 posted

     Hello,

    Attach the files to your SQL server instance using for example the SQL management Studio and change your connectionstring to connect into this database.

    Sunday, June 10, 2007 12:44 PM
  • User-1647864282 posted

    Well the thing is that I dont have a database created yet. I am trying to create a new database. If i create a database in SQL 2005 then my connectionstring will point to the database on sql server. I need the database to reside in the VS project like a stand alone .mdf file so that I can deply the database with my project.

     Does that make sense? Thanks for your help.

    Sunday, June 10, 2007 1:00 PM
  • User-1136466523 posted

    Hi,

    You may open your Machine.Config file (the file is in %SystemRoot%\Microsoft.NET\Framework\ver. number\CONFIG ). Try to find the ConnectionString node, modify the setting and make it look like

    <add name="LocalSqlServer" connectionString="data source=UserLT\SQL2005;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />

    Thanks.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 12, 2007 5:16 AM
  • User737013469 posted
    <connectionStrings>

    <add name="LocalSqlServer" connectionString="data source=.\MSSQLSERVER;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />

    </connectionStrings>

    Pasted above is the connectionStrings portion of my machine.config file.  I changed data source=.\MSSQLSERVER from SQLExperess.  However, I still cannot fix my issue.  Am I using incorrect syntax?

    Thanks,

    Sid

    Tuesday, March 18, 2008 12:36 AM
  • User1808049267 posted

    Hello, I just had SQL Server 2005 installed over my old SQL 2000 , and I am experiencing the same problem when I try to create a new mdf file in my App_Data. I am curious if anyone has the solution to this problem?

     Thanks.

    Wednesday, April 30, 2008 11:54 AM
  • User965108087 posted

     

    no i couldn and still having the same problem. In fact it says "connections to SQL server files(*.mdf) requires sql server express 2005 to function properly. Please verify the installation of the component or download from the url: http://go.microsoft.com/fwlink/?linkId=49251" .And i am using sql management studio 2005

    Wednesday, August 13, 2008 11:55 AM
  • User481669546 posted

     As far as i know a .mdf file is not supported by SQL Server 2005 only SQL Server Express.

    Friday, October 3, 2008 12:18 AM
  • User-1248165237 posted

    I tryed in Tools>Options>DataBase tools>Data Connection>Sql Server Instance Name as blank i.e, (blank for default)

    And worked me fine..

    Monday, November 3, 2008 4:53 PM
  • User742805821 posted

    Replacing the entry in Machine.Config didn't work.

    I found two copies of machine.config on drive c:\ I modified both entries by changing the server name. I still get exactly the same error.

    Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly.

    Of course, I also replaced the server name in the projects web.config file.

    This is just bizarre.  PS. The server I want to use is a SQL 2008 developer instance. All my *.config files refer to that.

    Sunday, March 15, 2009 7:38 AM
  • User742805821 posted

    It just gets more and more facinating.

    I restared the machine and logged on as a different user.

    The machine.config entries were both OK (using the name of my new Sql 2008 Developer server).

    Attempting to add a new database still gave the same error.

    I noticed that there were also:

    machine.config.default

    and

    machine.config.comments

    files.

    'machine.config.default' files still had the name of the defunct server (SQLEXPRESS). I changed it.

    I created a new web project. The web.config of the new project was still referring to "SQLEXPRESS" as the ApplicationServices connectionString. Where is it getting SQLEXPRESS from?

    "Add New Item, Data, Sql Server Database" still gives the same error message.

    By this time I'd completely lost confidence in my ability to control my computer. I did a global search for the string "SQLEXPRESS" on drive C:

    There were 74 files, 7 folders found. Which of these bastards is the culprit?  Or is the fault to be found in the registry?  If so where? and why?

     

    Sunday, March 15, 2009 8:47 AM
  • User907312395 posted

     Hi Guys,

     Any Luck? I am having the same problem and tried ALL the methods in this thread whenever I try to add a SQL Server 2005 database  in my App_Data folder but still the saaaame old error:

    Connection to SQL Server files (*.mdf) require SQL server express 2005 to function properly. please verify the installation of the component or download from the URL: go.microsoft.com/fwlink/?linkId=4925

    Please Guys, I desperately need help to fix this. Share all and any solutions you have.

    Please Thaanks!

    Monday, May 11, 2009 3:47 PM
  • Monday, May 11, 2009 5:28 PM
  • User-1089922554 posted
    you can attach Sqlserver mdf files with sqlserver express 2005 using bellow command try this replace "pubs" with "you database" name and mdf and ldf files EXEC sp_attach_db @dbname = 'pubs', @filename1 = 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf', @filename2 = 'C:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs_log.ldf'
    Friday, June 12, 2009 1:59 PM
  • User-1529035747 posted

    Hi, I was wondering if anyone has found a solution to the original problem posted.

    I installed SQL Server 2005 (Developer Edition) SP2 prior to installing Visual Studio 2008 (Professional Edition) SP1, with the instance name of SQLSERVER2005 - changing the default instance name through the Tools->Options->Database Tools->Database Connections still does not fix the problem. Although i'm able to add a connection in Server Explorer. I cannot add a new database .mdf file nor add existing item in the App_Data.

    Any help would be appreciated. Cheers

    Wednesday, July 15, 2009 9:40 PM
  • User614840377 posted

    I have the same problem on windows vista x64 - vs 2008 sp1 and SQL 2005 express, here's how I resolved my problem: 1. In VS2008 goto Tools/Options/Database Tools/Data Connections 2. in the blank text box that says (SQL Sever Instance Name (blank for default), I Enter sql 2005 express instance name like SQLEXPRESS then press OK button and problem is gone.

    Sunday, July 19, 2009 11:16 AM
  • User1096912014 posted

    Ok, I'm going to try the last solution now - my problem is with SQL Server 2008 Express and Vista 64. 

    Tuesday, October 20, 2009 10:39 PM
  • User1096912014 posted

    I have the same problem on windows vista x64 - vs 2008 sp1 and SQL 2005 express, here's how I resolved my problem: 1. In VS2008 goto Tools/Options/Database Tools/Data Connections 2. in the blank text box that says (SQL Sever Instance Name (blank for default), I Enter sql 2005 express instance name like SQLEXPRESS then press OK button and problem is gone.

     

    In the Tools/Options I don't see Database Tools.

    UPDATE. I did find it later, but the last suggestion didn't help. So far this problem is unresolved for me.

     

     

    Tuesday, October 20, 2009 10:44 PM
  • User1391799836 posted

    I worked on this problem for weeks, I reformated my computer at lease 5x and re-installed everything.

    There is a bug some where that Microsoft doesn't know about.  There are two ways installing Visual Studio 2008 Pro and MS-SQL 2008 Developers Edition.  I did install both ways and follow the install procedures that Microsoft SQlL help fiiles says to the letter.

    The problem steems from MS-SQL 2005 Shared files.  The upgrade to 2008 Shared files will cause the database connection error in VS 2008. And only in VS 2008. MSSQL Server is up and running in every other program..  It even works in VS 2008 Reporting Service, SQL Server Business Intelligence Development Studio, Microsoft SQL Server Integration Services, and Microsoft SQL Server Analysis Services.  But it will not create a database or the ASPNETDB.MDF from the ASP.NET configuration tool or from the add new item menu.

    The work around solution I came up with is to install SQL Server 2005 Express with Advance Tools.  Then Install MSSQL 2008 Developers Server and I didn't upgrade the SQLExpress instance to a 2008 instance 

    Tuesday, December 1, 2009 9:23 PM
  • User-419541720 posted

    You can Install SQL Express 2008 as an alternative to 2005. That is what I did. I have SQL Server 2008 Developer and I did not want to install the older version of the express. 

    Friday, June 11, 2010 4:07 PM
  • User1531306080 posted

    On 64-bit systems this error is often caused by 32/64 bit mismatch between Visual Studio 2008 and SQL Server 2008 Express. Visual Studio team published the following fix:

    http://support.microsoft.com/kb/957944

    I hope this will solve your problem,

    Good luck,

    Friday, June 11, 2010 6:44 PM
  • User841030251 posted

    yes sql server express require sql server files(*.mdf) to funtion properly

    Saturday, August 21, 2010 10:59 AM
  • User1923022023 posted

    I've been reading through for hours and nothing seems to work.  I've uninstalled and reinstalled (all options) of Visual studio 2010 Ultimate in hopes that that version of Sql Express would do it, uninstalled all versions of sql server (including full version) and tried multiple variations and even added an mdf to a vs2008 project (which worked) and then upgrading it to 2010 but it wouldn't grab the mdf.  Definitely some kind of bug and it's really bothering me because everything I see from Microsoft is trying to point to configuration and user error.  This IS a bug of some sort Microsoft...please get a clue and FIX it.  Search around and see that tons of people are having this same problem in VS2010.

    Thursday, September 2, 2010 9:17 PM
  • User-2037155782 posted

    I had SQL server 2008 R2 Express and i have the same issue in VS 2010. I fixed it when I Installed the SQL Server 2008 express and uninstalled my last SQL Server (I had the 2012 version and I uninstalled too). So, unfortunatelly, the only way i found to solve the problem is to install the SQL Server 2005/2008 Express.

    Wednesday, February 20, 2013 11:53 AM