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. MovePrev() throwing 265926 error code (End Of RowsSet).

MovePrev() throwing 265926 error code (End Of RowsSet).

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++question
15 Posts 5 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.
  • S Offline
    S Offline
    Sampath579
    wrote on last edited by
    #1

    Hi In my MFC application i am reading and MDB file using CCommand as follows:

    CDBPropSet cdbPropset;
    CCommand , CRowset> cCommand;
    cdbPropset.AddProperty(DBPROP_CANSCROLLBACKWARDS, true);
    cCommand.Open(m_pSessionManager->m_Session, csSQLQuery);
    hr = cCommand.MoveFirst();
    //insert some thing.
    hr = cCommand.MovePrev();

    In above code MovePrev() always throwing 265926 error code which is End Of RowsSet. Can any on let me know whats wrong in my code.? Why record is not moving to previous row? Thanks for the help.

    J S 2 Replies Last reply
    0
    • S Sampath579

      Hi In my MFC application i am reading and MDB file using CCommand as follows:

      CDBPropSet cdbPropset;
      CCommand , CRowset> cCommand;
      cdbPropset.AddProperty(DBPROP_CANSCROLLBACKWARDS, true);
      cCommand.Open(m_pSessionManager->m_Session, csSQLQuery);
      hr = cCommand.MoveFirst();
      //insert some thing.
      hr = cCommand.MovePrev();

      In above code MovePrev() always throwing 265926 error code which is End Of RowsSet. Can any on let me know whats wrong in my code.? Why record is not moving to previous row? Thanks for the help.

      J Offline
      J Offline
      Jochen Arndt
      wrote on last edited by
      #2

      You call MoveFirst() which sets the pointer to the first record. A following call to MovePrev() will of course fail with DB_S_ENDOFROWSET because the pointer is already at the first position which is the end of the row set for backward scrolling operations. I can't help further without knowing what you finally want to achieve (why do you want to scroll backwards). But moving backwards when already at the first position makes no sense.

      S 1 Reply Last reply
      0
      • J Jochen Arndt

        You call MoveFirst() which sets the pointer to the first record. A following call to MovePrev() will of course fail with DB_S_ENDOFROWSET because the pointer is already at the first position which is the end of the row set for backward scrolling operations. I can't help further without knowing what you finally want to achieve (why do you want to scroll backwards). But moving backwards when already at the first position makes no sense.

        S Offline
        S Offline
        Sampath579
        wrote on last edited by
        #3

        I am inserting some values in MDB. Lets say, after inserting 10 values, the pointer will be at 11 row since every time after inserting i will call movenext(). Now while inserting 11th value, i want to go to 10th row and delete the value in 10th row for which i need to call moveprev().

        J 1 Reply Last reply
        0
        • S Sampath579

          I am inserting some values in MDB. Lets say, after inserting 10 values, the pointer will be at 11 row since every time after inserting i will call movenext(). Now while inserting 11th value, i want to go to 10th row and delete the value in 10th row for which i need to call moveprev().

          J Offline
          J Offline
          Jochen Arndt
          wrote on last edited by
          #4

          This was not really clear from your question. To know what happens you should at least show some example lines. Note also that the behaviour depends on the used cursor type. A common method to identify rows that has been inserted is using bookmarks which can be used later to select the row. Maybe you should also rethink your design because inserting a row and deleting it within the same session makes no sense. Your code should detect that in advance so that there is no need to insert that row at all.

          S 1 Reply Last reply
          0
          • J Jochen Arndt

            This was not really clear from your question. To know what happens you should at least show some example lines. Note also that the behaviour depends on the used cursor type. A common method to identify rows that has been inserted is using bookmarks which can be used later to select the row. Maybe you should also rethink your design because inserting a row and deleting it within the same session makes no sense. Your code should detect that in advance so that there is no need to insert that row at all.

            S Offline
            S Offline
            Sampath579
            wrote on last edited by
            #5

            That was just an example i have given but not the exact requirement. But at any cost i want to perform this MovePrev() operation once at the end for my project requirement. But some how its failing (returning error code) even after setting the property on CBPropSet.

            CDBPropSet cdbPropset(DBPROPSET_ROWSET);
            cdbPropset.AddProperty(DBPROP_CANSCROLLBACKWARDS, true);

            CCommand ,CRowset> cCommand;
            hr = cCommand.Open(m_Session, csSQLQuery, &cdbPropset);
            if( SUCCEEDED( hr ) )
            {
            hr = cCommand.MoveFirst();

            for(int i = 0; i < 3; i++)
            {
            cCommand.m_labelvalueindex = 1;
            cCommand.m_labellinenumber = 2;

            hr = cCommand.Insert();
            hr = cCommand.MoveNext();
            }
            //Here i want to perform moveprev().
            cCommand.Close();
            }

            After the for loop i just want to perform Moveprev(). Can you tell me any wrong in above code.?

            J D 2 Replies Last reply
            0
            • S Sampath579

              That was just an example i have given but not the exact requirement. But at any cost i want to perform this MovePrev() operation once at the end for my project requirement. But some how its failing (returning error code) even after setting the property on CBPropSet.

              CDBPropSet cdbPropset(DBPROPSET_ROWSET);
              cdbPropset.AddProperty(DBPROP_CANSCROLLBACKWARDS, true);

              CCommand ,CRowset> cCommand;
              hr = cCommand.Open(m_Session, csSQLQuery, &cdbPropset);
              if( SUCCEEDED( hr ) )
              {
              hr = cCommand.MoveFirst();

              for(int i = 0; i < 3; i++)
              {
              cCommand.m_labelvalueindex = 1;
              cCommand.m_labellinenumber = 2;

              hr = cCommand.Insert();
              hr = cCommand.MoveNext();
              }
              //Here i want to perform moveprev().
              cCommand.Close();
              }

              After the for loop i just want to perform Moveprev(). Can you tell me any wrong in above code.?

              J Offline
              J Offline
              Jochen Arndt
              wrote on last edited by
              #6

              As already noted: Use bookmarks (see Using Bookmarks[^]). Set the bookmark when at the position you want to access later where you can then use MoveToBookmark().

              S 1 Reply Last reply
              0
              • J Jochen Arndt

                As already noted: Use bookmarks (see Using Bookmarks[^]). Set the bookmark when at the position you want to access later where you can then use MoveToBookmark().

                S Offline
                S Offline
                Sampath579
                wrote on last edited by
                #7

                Since my command class is CRowSet, there is no SetBookMark() method on it.

                J S 2 Replies Last reply
                0
                • S Sampath579

                  Since my command class is CRowSet, there is no SetBookMark() method on it.

                  J Offline
                  J Offline
                  Jochen Arndt
                  wrote on last edited by
                  #8

                  It is a CAccessor member.

                  1 Reply Last reply
                  0
                  • S Sampath579

                    That was just an example i have given but not the exact requirement. But at any cost i want to perform this MovePrev() operation once at the end for my project requirement. But some how its failing (returning error code) even after setting the property on CBPropSet.

                    CDBPropSet cdbPropset(DBPROPSET_ROWSET);
                    cdbPropset.AddProperty(DBPROP_CANSCROLLBACKWARDS, true);

                    CCommand ,CRowset> cCommand;
                    hr = cCommand.Open(m_Session, csSQLQuery, &cdbPropset);
                    if( SUCCEEDED( hr ) )
                    {
                    hr = cCommand.MoveFirst();

                    for(int i = 0; i < 3; i++)
                    {
                    cCommand.m_labelvalueindex = 1;
                    cCommand.m_labellinenumber = 2;

                    hr = cCommand.Insert();
                    hr = cCommand.MoveNext();
                    }
                    //Here i want to perform moveprev().
                    cCommand.Close();
                    }

                    After the for loop i just want to perform Moveprev(). Can you tell me any wrong in above code.?

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #9

                    Sampath579 wrote:

                    Can you tell me any wrong in above code.?

                    Is there a need to call MoveNext()? The for() loop is just inserting 3 rows, correct?

                    "One man's wage rise is another man's price increase." - Harold Wilson

                    "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                    "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

                    S 1 Reply Last reply
                    0
                    • D David Crow

                      Sampath579 wrote:

                      Can you tell me any wrong in above code.?

                      Is there a need to call MoveNext()? The for() loop is just inserting 3 rows, correct?

                      "One man's wage rise is another man's price increase." - Harold Wilson

                      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                      "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

                      S Offline
                      S Offline
                      Sampath579
                      wrote on last edited by
                      #10

                      If I don't call the movenext then pointer will be at one row and the data may overwrite. In my requirement I want to moveprev one step and delete it.

                      D 1 Reply Last reply
                      0
                      • S Sampath579

                        Hi In my MFC application i am reading and MDB file using CCommand as follows:

                        CDBPropSet cdbPropset;
                        CCommand , CRowset> cCommand;
                        cdbPropset.AddProperty(DBPROP_CANSCROLLBACKWARDS, true);
                        cCommand.Open(m_pSessionManager->m_Session, csSQLQuery);
                        hr = cCommand.MoveFirst();
                        //insert some thing.
                        hr = cCommand.MovePrev();

                        In above code MovePrev() always throwing 265926 error code which is End Of RowsSet. Can any on let me know whats wrong in my code.? Why record is not moving to previous row? Thanks for the help.

                        S Offline
                        S Offline
                        Stefan_Lang
                        wrote on last edited by
                        #11

                        I believe Jochen was spot on with his very first remark. The documentation of CRowset::MoveFirst | Microsoft Docs[^] clearly states that

                        Quote:

                        Calls IRowset::RestartPosition to reposition the next-fetch location to the initial position (the position that was the next-fetch location when the rowset was created) and retrieves the initial row.

                        (emphasis mine) In other words, your next Fetch would return the initial row at that time, no matter how many changes you made to the table in between the Move and the Fetch! Looks like you should trust your error message and change your code accordingly. P.S.: I just realized that it may still be considered ambiguous. However, you have to consider if (or why) the insertion of rows should affect the current Fetch position. The Insert command documentation does not indicate that it affects the Fetch position. If it would, shouldn't it say as much?

                        GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

                        S 1 Reply Last reply
                        0
                        • S Sampath579

                          If I don't call the movenext then pointer will be at one row and the data may overwrite. In my requirement I want to moveprev one step and delete it.

                          D Offline
                          D Offline
                          David Crow
                          wrote on last edited by
                          #12

                          Sampath579 wrote:

                          If I don't call the movenext then pointer will be at one row and the data may overwrite.

                          How have you verified this?

                          "One man's wage rise is another man's price increase." - Harold Wilson

                          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                          "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

                          1 Reply Last reply
                          0
                          • S Sampath579

                            Since my command class is CRowSet, there is no SetBookMark() method on it.

                            S Offline
                            S Offline
                            Sampath579
                            wrote on last edited by
                            #13

                            Small correction in my question. The error code is -2147217837.

                            1 Reply Last reply
                            0
                            • S Stefan_Lang

                              I believe Jochen was spot on with his very first remark. The documentation of CRowset::MoveFirst | Microsoft Docs[^] clearly states that

                              Quote:

                              Calls IRowset::RestartPosition to reposition the next-fetch location to the initial position (the position that was the next-fetch location when the rowset was created) and retrieves the initial row.

                              (emphasis mine) In other words, your next Fetch would return the initial row at that time, no matter how many changes you made to the table in between the Move and the Fetch! Looks like you should trust your error message and change your code accordingly. P.S.: I just realized that it may still be considered ambiguous. However, you have to consider if (or why) the insertion of rows should affect the current Fetch position. The Insert command documentation does not indicate that it affects the Fetch position. If it would, shouldn't it say as much?

                              GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

                              S Offline
                              S Offline
                              Sampath579
                              wrote on last edited by
                              #14

                              It does not work. Any other way of moving to previous record. MovePrev() throwing -2147217837 error code. I definitely need to go and get the data from MovePrev().

                              U 1 Reply Last reply
                              0
                              • S Sampath579

                                It does not work. Any other way of moving to previous record. MovePrev() throwing -2147217837 error code. I definitely need to go and get the data from MovePrev().

                                U Offline
                                U Offline
                                User 13938589
                                wrote on last edited by
                                #15

                                QASolved, a prominent name among the best & most affordable QuickBooks ProAdvisor Assistant in the US offers cost-efficient <QuickBooks ProAdvisor Support (877) 263-2742 specifically designed to cater to small businesses within the US region. Call us today to get in touch with a QB ProAdvisor in your area.

                                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