网格视图错误Visual Studio 2010 asp.NET Framework 4。找不到.NET Framework提供程序
我有一个SQL Compact edition数据库作为本地文件。我正在使用Visual Studio 2010访问数据库并创建我的asp.NET网站 在我的aspx页面设计视图中,数据显示良好,当我配置它并运行测试查询时,它工作良好 然而,当我运行我的页面时,我得到了这个奇怪的错误网格视图错误Visual Studio 2010 asp.NET Framework 4。找不到.NET Framework提供程序,asp.net,visual-studio-2010,gridview,Asp.net,Visual Studio 2010,Gridview,我有一个SQL Compact edition数据库作为本地文件。我正在使用Visual Studio 2010访问数据库并创建我的asp.NET网站 在我的aspx页面设计视图中,数据显示良好,当我配置它并运行测试查询时,它工作良好 然而,当我运行我的页面时,我得到了这个奇怪的错误 Unable to find the requested .Net Framework Data Provider. It may not be installed. Description: An unhan
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
就我个人而言,我不知道这是什么。。。我搜索了一下网络,发现它可能与我的web.config文件有关。我的aspx代码是:
<asp:SqlDataSource ID="pending" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT u.firstName, u.surname, w.url, c.companyName, o.cost FROM Website AS w INNER JOIN Orders AS o ON w.webID = o.websiteID INNER JOIN Company AS c ON w.companyID = c.companyID INNER JOIN Users AS u ON c.userID = u.userID WHERE (o.completed = 'N')"
ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>">
</asp:SqlDataSource>
<asp:GridView ID="grid" runat="server" AutoGenerateColumns="False"
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="firstName" HeaderText="firstName" ReadOnly="True"
SortExpression="firstName" />
<asp:BoundField DataField="surname" HeaderText="surname" ReadOnly="True"
SortExpression="surname" />
<asp:BoundField DataField="url" HeaderText="url" ReadOnly="True"
SortExpression="url" />
<asp:BoundField DataField="companyName" HeaderText="companyName"
ReadOnly="True" SortExpression="companyName" />
<asp:BoundField DataField="cost" HeaderText="cost" ReadOnly="True"
SortExpression="cost" />
</Columns>
</asp:GridView>
我们也有类似的问题。结果表明,SQL CE程序集不在目标服务器上,它不是.NET Framework的默认部分,而是辅助安装。通过在部署期间将SQLServerCE程序集包括在bin目录中,我们能够使所有内容都运行起来
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=Database.sdf;Password=XXXX;Persist Security Info=True"
providerName="Microsoft.SqlServerCe.Client.3.5" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="Accessibility, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
</assemblies>
</compilation>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration>