Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
分页计数错误asp.net_Asp.net_Sql Server_Paging_Datalist - Fatal编程技术网

分页计数错误asp.net

分页计数错误asp.net,asp.net,sql-server,paging,datalist,Asp.net,Sql Server,Paging,Datalist,我有一个带有分页的数据列表,在本地调试时可以正常工作,但在托管公司提供的部署服务器上无法工作 Line 151: TotalRowCount = pagedData.DataSourceCount; 我在本地和部署服务器上使用相同的远程数据库 错误消息: Server Error in '/' Application. Object reference not set to an instance of an object. Description: An unhandled e

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

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 

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

检查您是否可以使用正确的标识访问数据源