MovePrev() throwing 265926 error code (End Of RowsSet).
-
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.?
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()
. -
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()
.Since my command class is CRowSet, there is no SetBookMark() method on it.
-
Since my command class is CRowSet, there is no SetBookMark() method on it.
It is a
CAccessor
member. -
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.?
Sampath579 wrote:
Can you tell me any wrong in above code.?
Is there a need to call
MoveNext()
? Thefor()
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
-
Sampath579 wrote:
Can you tell me any wrong in above code.?
Is there a need to call
MoveNext()
? Thefor()
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
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.
-
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.
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)
-
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.
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
-
Since my command class is CRowSet, there is no SetBookMark() method on it.
Small correction in my question. The error code is -2147217837.
-
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)
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().
-
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().
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.