The selected object(s) use an unsupported database provider

…衆ロ難τιáo~ 提交于 2019-12-24 00:54:58

问题


I'm using Visual Studio 2010
In my project I was added a local database Data.sdf
Now I wanna use LINQ TO SQL with it, but when I drag and drop the database table into the LINQ designer , I get the following error in Visual Studio :

"The selected object(s) use an unsupported database provider"

Am I miss something ?
How can I fix it ?


回答1:


LINQ-to-SQL is only officially supported when used with a full version of Microsoft SQL Server (including Express editions). While it's possible to use it with SQL Server CE (which is what it appears you're trying to do) and some others, extra steps are required.

You can either:

  • Use SqlMetal.exe to generate your .dbml file, then load it into your project (assuming you're using SQLCE 3.5; it doesn't appear to work with 4.0)
  • Keep an identical copy of your database schema in a SQL Server Express database on your local machine. Use that for design work, then connect to your SQL CE database at runtime.



回答2:


Geometry, Geography and Hierarchy data types are not supported in LINQ to SQL.The only way it would be to not reference those columns and modify them so they can hold null values




回答3:


I had this issue but it was resolved after installing the EntitiFramework package from Nuget. ppm> install-package EntityFramework



来源:https://stackoverflow.com/questions/5571276/the-selected-objects-use-an-unsupported-database-provider

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!