.net框架数据提供程序错误

时间:2011-01-20 18:05:37

标签: visual-studio-2010

这是什么错误(当我测试我的项目时出现)

-->
Unable to find the requested .Net Framework Data Provider.  It may not be installed. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: Unable to find the requested .Net Framework Data Provider.  It may not be installed.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 


[ArgumentException: Unable to find the requested .Net Framework Data Provider.  It may not be installed.]
   System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +1402071
   System.Web.UI.WebControls.SqlDataSource.GetDbProviderFactory() +67
   System.Web.UI.WebControls.SqlDataSource.GetDbProviderFactorySecure() +22
   System.Web.UI.WebControls.SqlDataSource.CreateConnection(String connectionString) +11
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +117
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
   System.Web.UI.WebControls.GridView.DataBind() +4
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75
   System.Web.UI.Control.EnsureChildControls() +102
   System.Web.UI.Control.PreRenderRecursiveInternal() +42
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496

这是配置

<configuration>
<connectionStrings>
<add name="ConnectionString" connectionString="DataSource=C:\ProgramFiles\Microsoft    SQL     Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\CIEDB.sdf;Password=sa;Persist Security Info=True"
providerName="Microsoft.SqlServerCe.Client.3.5" />
<add name="ConnectionString2" connectionString="Data Source=C:\Program Files\Microsoft   SQL Server Compact Edition\v3.5\Samples\Northwind.sdf"
providerName="Microsoft.SqlServerCe.Client.3.5" />
</connectionStrings>
<system.web>
    <compilation debug="true" targetFramework="4.0"/>
</system.web>
</configuration>

3 个答案:

答案 0 :(得分:0)

您可能必须在测试项目的.config文件中设置正确的配置信息(连接字符串)

编辑:使用该配置,我做了一些搜索并遇到了这个论坛帖子:
http://social.msdn.microsoft.com/Forums/en-US/sqlce/thread/ff731bf4-1f50-4f77-955b-e4534474a271/

明显接受的答案是:

  

我通过手动安装修复了我的问题   来自Vs SP1的SSCEVSTools-Enu.msi。

还有一些其他results on Bing也可能有用。希望它有所帮助

答案 1 :(得分:0)

当我安装Visual Studio 2010 SP1时遇到同样的错误,然后在我发现它不是那么好之后回滚(主要的轻描淡写......远离VS2010 SP1)。我在网上找到了我可以通过重新安装来解决这个问题,我从这里得到了这个文件。重新安装该软件后,我启动了VS 2010,一切恢复正常。希望它适合你。

以下是我用来获取该软件包的链接:

http://download.microsoft.com/download/0/5/D/05DCCDB5-57E0-4314-A016-874F228A8FAD/SSCEVSTools-ENU.msi

答案 2 :(得分:0)

根据您的描述,我假设连接字符串无效。创建工作连接字符串的一种简单方法如下:

  1. 在桌面上创建一个新的空文本文件
  2. 将其文件扩展名更改为.udl
  3. 双击它。这将打开连接向导。
  4. 配置连接。然后单击TEST。如果连接成功,请关闭向导
  5. 在文本编辑器中打开.udl文件。它包含有效的连接字符串。
  6. 将连接字符串从文本编辑器复制到Visual Studio数据源字符串中。