Large row count in table causes exception in OleDbCommand.ExecuteReader RRS feed

  • Question


    I'm accessing a table in Sybase that has nearly 12 million rows (Select * from table).  Each row has three columns: int, char(17), int.

    ExecuteReader receives an exception generated from an external component. 

    I tried changing the timeout from 30 to 600.  The exception occurred a few minutes in.

    I tried passing CommandBehavior.SequentialAccess to ExecuteReader, all to no avail.

    I don't know what to do differently.  ExecuteReader works great with fewer total rows.

    Here is the exception text:

    System.Runtime.InteropServices.SEHException was caught

      Message=External component has thrown an exception.




           at System.Data.Common.UnsafeNativeMethods.IRowset.GetNextRows(IntPtr hChapter, IntPtr lRowsOffset, IntPtr cRows, IntPtr& pcRowsObtained, IntPtr& pprghRows)

           at System.Data.OleDb.OleDbDataReader.GetRowHandles()

           at System.Data.OleDb.OleDbDataReader.ReadRowset()

           at System.Data.OleDb.OleDbDataReader.Read()

           at System.Data.OleDb.OleDbDataReader.NextResult()

           at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)

           at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)

           at Ice.Database.Access.IceDatabase.ExecuteTextQuery(String sQueryStatement, ArrayList& schema, ArrayList& results, Boolean closeAfterQuery) in C:\Documents and Settings\mrl5340\My Documents\Visual Studio 2010\Projects\TestMsl1\TestMsl1\IceDatabaseAccess.cs:line 183



    • Moved by ErikEJMVP Wednesday, February 2, 2011 2:39 PM wrong forum (From:SQL Server Compact)
    Tuesday, February 1, 2011 11:31 PM


  • Hi Grabe,

    Welcome to ADO.Net Managed Providers.

    It seems cause by the data source or memroy resource.

    1、 Please use the "SQL Server Profiler" to monitor whether there is any exception happened;

    2、Could you give me more information about the utilization of this operation or the code snippet;

    I hope that would be help you.


    If it's helpful for you, Please vote or mark. Thank you!

    David Peng [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, February 3, 2011 9:44 AM