求助:DataSet填充问题,总提示出现 OutOfMemoryException,如何解决?代码在内,请大家看看,谢谢!
一个ASP项目,这里是出问题的代码(数据库是SQL2000):
static DataSet ds = new DataSet() ;
SqlConnection conn = new SqlConnection((string)Application["sqlConnectionStringBooks"]) ;
string sql = "select * from 表格1 order by 序号";
SqlDataAdapter da = new SqlDataAdapter(sql, conn) ;
da.Fill(ds, "表格1") ; //这一句总是出现异常
请大家帮忙看看,这个问题怎么解决?谢谢
【另附】:错误提示如下:
“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------
引发类型为“System.OutOfMemoryException”的异常。
说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.OutOfMemoryException: 引发类型为“System.OutOfMemoryException”的异常。
堆栈跟踪:
[OutOfMemoryException: 引发类型为“System.OutOfMemoryException”的异常。]
System.Data.SqlTypes.SqlBinary.get_Value() +31
System.Data.SqlClient.SqlBuffer.get_ByteArray() +36
System.Data.SqlClient.SqlBuffer.get_Value() +5043138
System.Data.SqlClient.SqlDataReader.GetValueInternal(Int32 i) +111
System.Data.SqlClient.SqlDataReader.GetValues(Object[] values) +184
System.Data.ProviderBase.CommonLanguageSubsetDataReader.GetValues(Object[] values) +13
System.Data.ProviderBase.SchemaMapping.LoadDataRow() +46
System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping) +96
System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) +164
System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) +424
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +204
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +319
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +92
proj01.p0050.dropdownlist1() in d:\yjs\proj04\p0050.aspx.cs:78
proj01.p0050.Page_Load(Object sender, EventArgs e) in d:\yjs\proj04\p0050.aspx.cs:41
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
dataset --------------------编程问答-------------------- 内存溢出?多少记录 --------------------编程问答-------------------- 大概几百条吧~ --------------------编程问答--------------------
我把
select * from 表格1 order by 序号
改成
select * from 表格1 where 序号 = 1
之后,应该就不存在记录太多的问题了呀,可是
da.Fill(ds, "表格1") ;
这一句还是出错,溢出... --------------------编程问答--------------------
这个问题是最近升级了ASP 4.0之后出现的,以前好像没这个问题... --------------------编程问答-------------------- lz试试这句报错不
select top 100 * from 表格1
select top 100 * from 表格1 order by 序号 --------------------编程问答--------------------
试过了,
select top 100 * from 表格1 order by 序号
不报错了!呵呵~
接下来,如何保证完整呢?
补充:.NET技术 , ASP.NET