Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. ADO Recordset closed after execution with no records returned

ADO Recordset closed after execution with no records returned

Scheduled Pinned Locked Moved C / C++ / MFC
helpdatabasequestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fayu
    wrote on last edited by
    #1

    Hi, I am having an issue with a recordset that is closed after executing a query. The query that I am using is shown below in Query 1. However, When I change this query to 'SELECT * FROM SOMETABLE', then the recordset is not closed and an open record set is returned. Any ideas? Below is my code: Code:

    //vSource is the the query below
    //vConnection is a active open connection
    //eCursorType = adOpenStatis
    //eLockType = adLockOptimistic
    //eOption = adCmdText. I tried combining this with adExecuteRecord using
    // Bit OR with an error. Bit AND caused no errors
    // but also returned a closed recordset
    pRst->raw_Open(vSource, vConnection, eCursorType, eLockType, lOptions);

    Query 1:

    DECLARE @Id bigint
    SET @Id = 2539
    if OBJECT_ID('tempdb..#dumpTable','local') IS NOT NULL
    BEGIN
    DROP TABLE #dumpTable
    END

    CREATE TABLE #dumpTable
    (
    Depth bigint,
    Parent bigint,
    Type bigint,
    ID bigint,
    Name nvarchar(80)
    )
    BEGIN
    --SOME WORK
    SELECT * FROM #DumpTable

    DROP TABLE #DumpTable
    END

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups