asp.net 分页计数错误

发布于 2024-07-16 17:49:26 字数 2574 浏览 10 评论 0原文

我有一个带有分页的数据列表,它可以在本地调试正常工作,但不能在我的托管公司提供的部署服务器上工作。

Line 151:        TotalRowCount = pagedData.DataSourceCount;

我在本地和部署服务器上使用相同的远程数据库。

错误信息:

Server Error in '/' Application.
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 149:
Line 150:        // Remember the total number of records being paged through across postbacks
Line 151:        TotalRowCount = pagedData.DataSourceCount;
Line 152:        PrevPage.Visible = !pagedData.IsFirstPage;
Line 153:        NextPage.Visible = !pagedData.IsLastPage;


Source File: \\pdc1\sites\t\test.domain.com\public_html\Auctions.aspx.cs    Line: 151

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   Auctions.ItemDataSource_Selected(Object sender, ObjectDataSourceStatusEventArgs e) in \\pdc1\sites\t\test.domain.com\public_html\Auctions.aspx.cs:151
   System.Web.UI.WebControls.ObjectDataSourceView.OnSelected(ObjectDataSourceStatusEventArgs e) +95
   System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +432
   System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1247
   System.Web.UI.WebControls.BaseDataList.GetData() +38
   System.Web.UI.WebControls.DataList.CreateControlHierarchy(Boolean useDataSource) +153
   System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +54
   System.Web.UI.WebControls.BaseDataList.DataBind() +55
   System.Web.UI.WebControls.BaseDataList.EnsureDataBound() +60
   System.Web.UI.WebControls.BaseDataList.CreateChildControls() +69
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +44
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842


Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053 

I have a data list with paging which works fine locally debugging but doesn't work on my deployment server provided by my hosting company.

Line 151:        TotalRowCount = pagedData.DataSourceCount;

I'm using the same remote database for both local and on deployment server.

Error message:

Server Error in '/' Application.
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 149:
Line 150:        // Remember the total number of records being paged through across postbacks
Line 151:        TotalRowCount = pagedData.DataSourceCount;
Line 152:        PrevPage.Visible = !pagedData.IsFirstPage;
Line 153:        NextPage.Visible = !pagedData.IsLastPage;


Source File: \\pdc1\sites\t\test.domain.com\public_html\Auctions.aspx.cs    Line: 151

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   Auctions.ItemDataSource_Selected(Object sender, ObjectDataSourceStatusEventArgs e) in \\pdc1\sites\t\test.domain.com\public_html\Auctions.aspx.cs:151
   System.Web.UI.WebControls.ObjectDataSourceView.OnSelected(ObjectDataSourceStatusEventArgs e) +95
   System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +432
   System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1247
   System.Web.UI.WebControls.BaseDataList.GetData() +38
   System.Web.UI.WebControls.DataList.CreateControlHierarchy(Boolean useDataSource) +153
   System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +54
   System.Web.UI.WebControls.BaseDataList.DataBind() +55
   System.Web.UI.WebControls.BaseDataList.EnsureDataBound() +60
   System.Web.UI.WebControls.BaseDataList.CreateChildControls() +69
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +44
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842


Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

超可爱的懒熊 2024-07-23 17:49:26

这意味着从服务器到数据库的连接不起作用,因为 pagedData 对象为空。

检查您是否可以使用正确的身份访问您的数据源。

This implies the connection to your database from the server isn't working, as the pagedData object is null.

Check you can access your datasource, with the correct identity.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文