Click here to Skip to main content
15,896,440 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
hey friends i got error while attching service based database to my windows application as well as when i trying to attach local database it attached succsessfully but sql connection closes when i build project. i really dont know how to solve this issue. i did go through all possible solutions on web but not worked , suggest me any possible way.

here is the error sentence-

""connections to sqlserver database files(.mdf) require sql server 2005 or 2008 installed in your pc""
Posted
Comments
The message is clear. You are trying to connect to a mdf file, but you don't have sql server.
Member 11543226 2-May-15 6:40am    
BUT I have sql server 2008 r2 installed successfully

1 solution

Attaching an .mdf database file is a feature that is only supported for SQL Server Express. You either need to install the Express edition or attach it from within SQL Server Management Studio to make it a regular database instance. I would recommend the latter because (from MSDN):

"This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature."

Another possible cause might be that you installed SQL Server after Visual Studio.

You find more information about this here:
https://msdn.microsoft.com/en-us/library/ms254504.aspx[^]
https://msdn.microsoft.com/en-us/library/ms143684%28v=sql.105%29.aspx[^]
http://serverfault.com/questions/319912/i-am-very-confused-with-sql-server-express-instances-what-am-i-actually-connec[^]
http://stackoverflow.com/questions/4183485/what-are-in-sql-server-user-instances-that-make-them-impossible-in-non-express-e[^]
http://stackoverflow.com/questions/4650183/problem-with-creating-mdf-file-from-visual-studio-2010[^]
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/6503fe05-4d05-49e7-8c2a-b9778ab7e9b8/connections-to-sql-server-files-mdf-require-sql-server-express-2005?forum=sqlsetupandupgrade[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900