CRecordset::Open raise exception when the table has large amout of records


  • Hi All,

    In my application, using CRecordSet to handle the SQL Server data access, and when the record in the table was less than 1Million, there was not problem.

    but when the records are more than 1 million, the CRecordSet::Open will raise exception.


    ChildEBP RetAddr Args to Child 13beea40 7773319f 00000001 6cdd0000 00000000 ntdll!RtlImageNtHeaderEx+0xba (FPO: [SEH]) 13beea60 777419de 6cdd0000 643e3ea3 6cdd0000 ntdll!RtlImageNtHeader+0x1b (FPO: [1,1,0]) 13beeaa0 7774197e 6cdd0000 00000000 00000000 ntdll!LdrpGetFromMUIMemCache+0x42 (FPO: [SEH]) 13beead0 7774190e 6cdd0000 00000000 00000001 ntdll!LdrpGetRcConfig+0x21 (FPO: [4,4,0]) 13beeaf0 7774178e 6cdd0000 13beebc4 00000003 ntdll!LdrIsResItemExist+0x19 (FPO: [4,1,4]) 13beeb98 77755655 6cdd0000 13beebc4 00000003 ntdll!LdrpSearchResourceSection_U+0xc9 (FPO: [SEH]) 13beec00 768d4aa2 6cdd0000 000000ef 00000000 ntdll!RtlLoadString+0x10e (FPO: [SEH]) 13beec3c 76928ed2 6cdd0000 000000ef 01563d6c KERNELBASE!LoadStringBaseExW+0x51 (FPO: [5,3,0]) 13beec58 6dda59ed 6cdd0000 000000ef 01563d6c USER32!LoadStringW+0x19 (FPO: [4,0,0]) 13beec70 6dda6686 015633b8 015633b0 00000000 ODBC32!StringCbCopyNW+0x276 (FPO: [0,0,4]) 13beec88 6dda6e0f 015633b8 13bef224 015633b0 ODBC32!PostErrorArg+0x518 (FPO: [1,2,0]) 13beecfc 6dda7611 015633b0 0155eed8 13beed18 ODBC32!PostErrorArg+0xcc0 (FPO: [0,23,4]) 13beed28 6dda7bd4 015633b0 13beedb0 13beedc0 ODBC32!SQLGetDiagRecW+0x524 (FPO: [5,7,0]) 13beed54 6f4b296e 0155eed8 01562e30 00000000 ODBC32!SQLErrorW+0x10d (FPO: [8,1,4]) 13bef240 6f4b3df8 01480680 015633b0 00000000 mfc90u!CDBException::BuildErrorString+0x89 (CONV: thiscall) [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\dbcore.cpp @ 144] 13bef264 6f4b3aad b92feeff 13bef41c 13bef624 mfc90u!CRecordset::IsOpen+0x6d (CONV: thiscall) [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\dbcore.cpp @ 1258] 13bef298 0fbe405f 00000001 00000000 00000000 mfc90u!CRecordset::Open+0x16 (CONV: thiscall) [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\dbcore.cpp @ 1072] 13bef384 0fbe78c9 13bef41c 13bef624 00000003 XXXODBC!CLogManager::OpenDBForRead+0x35f (FPO: [Non-Fpo]) (CONV: thiscall)

    13bef418 7516592c 01462680 00000804 00d8743c XXXODBC!CODBCAdaptor::ReadMessages+0xb9 (FPO: [Non-Fpo]) (CONV: stdcall)

    13bef440 751e05f1 0fbe7810 13bef628 00000005 RPCRT4!Invoke+0x2a

    Then after CRecordset::IsOPen return, will runinto PrepareAndExecute


    ChildEBP RetAddr  Args to Child              
    13befb10 7515383b 80010105 00000001 00000000 KERNELBASE!RaiseException+0x58 (FPO: [4,20,0])
    13befb2c 7559a4b8 80010105 00d8d1c0 00000000 RPCRT4!RpcpRaiseException+0x7b (FPO: [1,0,4])
    13befb74 75165eba 00d949e8 b9e39c6e 00d8d1c0 ole32!ThreadInvoke+0xb7 (FPO: [Non-Fpo]) (CONV: stdcall) [d:\w7rtm\com\ole32\com\dcomrem\channelb.cxx @ 4671]
    13befbac 7516624c 7559df76 00d949e8 13befc90 RPCRT4!DispatchToStubInCNoAvrf+0x46 (FPO: [SEH])
    13befc04 751667f5 00000000 00000000 00000000 RPCRT4!RPC_INTERFACE::DispatchToStubWorker+0x141 (FPO: [4,14,4])
    13befc28 75166796 00d949e8 00000000 00000000 RPCRT4!RPC_INTERFACE::DispatchToStub+0x90 (FPO: [4,0,4])
    13befc64 751666b1 00d949e8 00d94a4c 00000000 RPCRT4!RPC_INTERFACE::DispatchToStubWithObject+0xbc (FPO: [5,6,4])
    13befcb0 751665c3 13befcc8 00000000 00dfdd80 RPCRT4!LRPC_SCALL::DispatchRequest+0x214 (FPO: [1,9,4])
    13befcd0 75166581 00d94930 00dfdda8 00ddb528 RPCRT4!LRPC_SCALL::QueueOrDispatchCall+0xc7 (FPO: [0,2,4])
    13befcec 75166425 00dfdd80 00d8d1c0 00000000 RPCRT4!LRPC_SCALL::HandleRequest+0x305 (FPO: [4,2,4])
    13befd1c 75166398 00dfdd80 00ded878 00000000 RPCRT4!LRPC_SASSOCIATION::HandleRequest+0x153 (FPO: [5,3,4])
    13befd50 75164abf 00dfdd80 13befd90 00ded878 RPCRT4!LRPC_ADDRESS::HandleRequest+0xc4 (FPO: [4,3,4])
    13befddc 751649ac 00000000 13befdf8 7516480f RPCRT4!LRPC_ADDRESS::ProcessIO+0x44c (FPO: [1,24,0])
    13befde8 7516480f 00d8d374 00000000 13befe20 RPCRT4!LrpcServerIoHandler+0x16 (FPO: [2,0,0])
    13befdf8 77764766 13befe64 00d8d374 00d98d68 RPCRT4!LrpcIoComplete+0x16 (FPO: [4,0,0])
    13befe20 7775341f 13befe64 00000000 00000000 ntdll!TppAlpcpExecuteCallback+0x1c5 (FPO: [4,1,4])
    13beff88 74e833aa 00d65f10 13beffd4 77739ef2 ntdll!TppWorkerThread+0x5a4 (FPO: [SEH])
    13beff94 77739ef2 00d65f10 643e2bd7 00000000 kernel32!BaseThreadInitThunk+0xe (FPO: [1,0,0])
    13beffd4 77739ec5 77753e45 00d65f10 00000000 ntdll!__RtlUserThreadStart+0x70 (FPO: [SEH])
    13beffec 00000000 77753e45 00d65f10 00000000 ntdll!_RtlUserThreadStart+0x1b (FPO: [2,2,0])

    (518.178c): C++ EH exception - code e06d7363 (first chance)
    (518.178c): C++ EH exception - code e06d7363 (first chance)
    (518.178c): Unknown exception - code 80010105 (first chance)
    First chance exceptions are reported before any exception handling.
    This exception may be expected and handled.
    eax=0271fac0 ebx=00000000 ecx=00000000 edx=0030b434 esi=80010105 edi=766c7430
    eip=74d9c41f esp=0271fac0 ebp=0271fb10 iopl=0         nv up ei pl zr na pe nc
    cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00000246

    Is there any limitations about CRecordSet? Or anything need to take care when using this class?

    To solve this issue anything else needed I should provide?

    Sorry for I'm very new for DB programming.


    One world, one dream

    • Edited by Levi Zhou Thursday, March 06, 2014 8:19 AM
    Wednesday, March 05, 2014 8:19 AM


All replies

  • Root cause: query timeout.

    One world, one dream

    • Marked as answer by Levi Zhou Thursday, March 06, 2014 8:47 AM
    Thursday, March 06, 2014 8:47 AM
  • Hi Levi,

    Glad to hear your issue have been sovled and thanks for sharing. Have a nice day!


    Elvis Long
    TechNet Community Support

    Thursday, March 06, 2014 9:19 AM