I am looking to add a local database file (.sdf) into my .NET Project.
- I right click on my project, click "Add" -> "New Item"
- Select "Local Database" and rename it to what I want.
- I click the "Add" button and get the following error
"The开发者_JS百科 data provider required to connect to the local data file could not be found. The file will be added to the project but the typed DataSet assosciated with the file will not be generated."
I am using Visual Studio 2008 .NET Framework 3.5
Could anyone please advise as to why this is happening?
Have you tried adding a reference to the SQL Server CE assembly before adding the file? you shouldn't need to, but you might have a conflict somewhere.
For me, I automatically get a reference to C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Desktop\System.Data.SqlServerCe.dll
Also, it's worth checking that you have the "Microsoft SQL Server Compact 3.5 SPx Design Tools English" installed, (where SPx is the service pack version, and the English is your preferred language)
You might be missing the SqlCompact 3.5sp1 install or possibly the SqlCompact tools for visual studio. Try installing or reinstalling those.
http://www.microsoft.com/downloads/details.aspx?FamilyId=DC614AEE-7E1C-4881-9C32-3A6CE53384D9&displaylang=en
An sdf file is for SQL Server 2005 Compact Edition or SQL Server 2005 Mobile Edition do you have either of these already installed on your machine?
If your after just a normal database it the mdf file list as "SQL Server database" in VS2008.
I ran a repair on Visial Studio and it seems to have fixed the problem.
Just install Visual Studio Service Pack 1 and all will be OK. You can download it here. If the problem continues, start VS2008 with /resetskippkgs in cmd. For that, open cmd, locate devenv.exe (in C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE
) and just type devenv.exe /resetskippkgs
.
精彩评论