GridView
을 사용하여 SQL Server에서 가져온 테이블을 표시하려고합니다. 이벤트 로그입니다. GridView
컨트롤을 ObjectDataSource
컨트롤과 함께 내 페이지에 배치했습니다. 나는 구성한 다음과 같이OutOfMemoryException GridView에 ObjectDataSource 바인딩
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
</head>
<body>
<form id="Form1" method="post" runat="server">
<asp:GridView ID="gvHistory" runat="server" DataSourceID="dsHistory">
</asp:GridView>
<asp:ObjectDataSource ID="dsHistory" runat="server" SelectMethod="GetHistoryRows"
TypeName="AspDotNetStorefrontAdmin.ROIImportHistory"></asp:ObjectDataSource>
</form>
</body>
</html>
은 내가 App_Code
폴더에 클래스를 만들었습니다 그러나
Imports System.Data
Namespace AspDotNetStorefrontAdmin
Public Class ROIImportHistory
Public Shared Function GetHistoryRows() As DataTable
Dim localDatatable As New DataTable
localDatatable.Columns.Add()
localDatatable.Columns.Add()
localDatatable.Columns.Add()
localDatatable.Rows.Add(New Object() {"Hi", "Hi2", "Hi3"})
Return localDatatable
End Function
End Class
End Namespace
, 나는이 실행하려고하면 나는 다음과 같은 예외가 :
을무엇이 잘못 되었나요? 나는 여기서 내가 아주 기본적인 일을하고 있다고 생각했다. 나는 많은 다른 옵션을 시도하고 GridView
또는 ObjectDataSource
을 제거하면 페이지가 잘 작동한다는 것을 알 수 있습니다. 내가 DataTable
을 GridView
에 직접 바인딩하면 올바르게 작동합니다.
내 목적은 필터링과 함께 진정한 페이지 매김을 얻는 것입니다. 주어진 페이지가로드 될 때마다 DataTable
을로드하려고합니다.
Server Error in '/' Application.
Exception of type 'System.OutOfMemoryException' was thrown.
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.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
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:
[OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.]
System.Reflection.Assembly._GetType(String name, Boolean throwOnError, Boolean ignoreCase) +0
System.Web.UI.Util.GetTypeFromAssemblies(ICollection assemblies, String typeName, Boolean ignoreCase) +201
System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +302
System.Web.UI.WebControls.ObjectDataSourceView.GetType(String typeName) +70
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1692
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +27
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +261
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +95
System.Web.UI.Control.EnsureChildControls() +146
System.Web.UI.Control.PreRenderRecursiveInternal() +61
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Control.PreRenderRecursiveInternal() +224
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394
Version Information: Microsoft .NET Framework Version:2.0.50727.6400; ASP.NET Version:2.0.50727.6387
참고 :이 코드가 동일한 응용 프로그램 풀의 동일한 서버에있는 다른 사이트에로드되어 실행되는 것으로 나타났습니다. 따라서이 문제는 구성 문제와 관련이 있다고 생각합니다.
위 질문에 수정 사항을 적어 두십시오. 내가 올바르게 사용하고있는 것을 볼 수 있습니다. 또한 http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.objectdatasource.select.aspx에서 볼 수 있듯이 'DataTable'은 지원되는 데이터 소스입니다. – cjbarth