|
-
Apr 15th, 2003, 11:27 AM
#1
Thread Starter
Fanatic Member
ADO MoveFirst and NEXT
Got an ADO RECORDSET and
Did a move first...
A Subsequent MOVE NEXT.. doesn't get me to the next record
I have to do 2 MOVENEXT to get to it
Any idea why?
Is that a bug?
-
Apr 15th, 2003, 11:41 AM
#2
It sound as if your provider moves to BOF instead of the first record when you call the MoveFirst method.
-
Apr 15th, 2003, 11:50 AM
#3
Thread Starter
Fanatic Member
...would
But I can actually look at the record after a movefirst...
-
Apr 15th, 2003, 11:53 AM
#4
Yeah that is fully possible, a lot of providers return the first record when you stand on BOF as long as the recordset isn't empty.
-
Apr 15th, 2003, 12:10 PM
#5
Thread Starter
Fanatic Member
true
but... Another subsequent next would yield the next record, I suppose... Not so..
-
Apr 15th, 2003, 12:14 PM
#6
Re: ADO MoveFirst and NEXT
Originally posted by Lafor
Got an ADO RECORDSET and
Did a move first...
A Subsequent MOVE NEXT.. doesn't get me to the next record
I have to do 2 MOVENEXT to get to it
Any idea why?
Is that a bug?
do you have a blank record in the database?
-
Apr 15th, 2003, 12:58 PM
#7
Re: true
Originally posted by Lafor
but... Another subsequent next would yield the next record, I suppose... Not so..
No, if you stand on BOF a call to move next will move to the first record.
VB Code:
rs.MoveFirst
If rs.BOF Then
rs.MoveNext
End If
-
Apr 15th, 2003, 01:15 PM
#8
Re: Re: true
Originally posted by Joacim Andersson
No, if you stand on BOF a call to move next will move to the first record.
VB Code:
rs.MoveFirst
If rs.BOF Then
rs.MoveNext
End If
but calling the .MoveFirst method puts you at the first record.. not before it
-
Apr 15th, 2003, 01:18 PM
#9
Let me in ..
Re: Re: Re: true
Originally posted by kleinma
but calling the .MoveFirst method puts you at the first record.. not before it
Not really .... it puts the RecordPointer on BOF ... 1 before the first record. But as soon as you start reading it, it increases the record pointer by 1 automatically for the first time.
-
Apr 15th, 2003, 01:20 PM
#10
Re: Re: Re: Re: true
Originally posted by techyspecy
Not really .... it puts the RecordPointer on BOF ... 1 before the first record. But as soon as you start reading it, it increases the record pointer by 1 automatically for the first time.
well what i am saying is if you do
VB Code:
RS.Open "SELECT BLAH FROM BLAH"
RS.MoveFirst
Do Until RS.EOF
Debug.Print RS(0)
RS.MoveNext
Loop
you will get all records without missing the first and without skipping any
-
Apr 15th, 2003, 01:22 PM
#11
Let me in ..
Re: Re: Re: Re: Re: true
Originally posted by kleinma
well what i am saying is if you do
VB Code:
RS.Open "SELECT BLAH FROM BLAH"
RS.MoveFirst
Do Until RS.EOF
Debug.Print RS(0)
RS.MoveNext
Loop
you will get all records without missing the first and without skipping any
True - but that may not neccesarily mean that record 1 holds the record pointer when you do movefirst.
-
Apr 15th, 2003, 01:31 PM
#12
Re: Re: Re: true
Originally posted by kleinma
but calling the .MoveFirst method puts you at the first record.. not before it
If you read the origional question and my first reply you'll see that it seems as if his provider is treating this wrong.
-
Apr 15th, 2003, 01:44 PM
#13
Let me in ..
Re: Re: Re: Re: true
Originally posted by Joacim Andersson
If you read the origional question and my first reply you'll see that it seems as if his provider is treating this wrong.
Nothing is treating him wrong. Its absolutely right. He click on the button until he is on first record and first record gets displayed in the text boxes and then he clicks again which puts the record pointer in the BOF position. Mind you, first record is not BOF. BOF comes when you do MovePrevious on first record. Now he clicks the other button for movenext. When he clicks once, the record pointer comes on first record and first record is already displayed so it looks as if nothing has happened. When he clicks again the record pointer moves to 2nd record and 2nd record gets displayed and so on.
There is nothing wrong with any provider or anything. This is ADO phenomenon and it has nothing to do with Providers.
-
Apr 15th, 2003, 01:45 PM
#14
Thread Starter
Fanatic Member
?..
Think I found what the prob is
This table for some reason has duplicate entries...
And the way the original programmer wrote the code to navigate through the recordset was:
Display current record
Do a move first to get to the first record and
and compare with the displayed record
if same then do a move next
and that would repeat everytime the > button is pressed..
-
Apr 15th, 2003, 01:46 PM
#15
Let me in ..
Re: ?..
Originally posted by Lafor
Think I found what the prob is
This table for some reason has duplicate entries...
And the way the original programmer wrote the code to navigate through the recordset was:
Display current record
Do a move first to get to the first record and
and compare with the displayed record
if same then do a move next
and that would repeat everytime the > button is pressed..
Check my last post .... there is nothing wrong with your code i think.
-
Apr 15th, 2003, 01:57 PM
#16
Re: Re: ?..
Originally posted by techyspecy
Check my last post .... there is nothing wrong with your code i think.
MoveFirst followed by MoveNext should result in him standing on the the second record, right? In his origional post he said he didn't (though he probably is since he has duplicats in hid DB).
-
Apr 15th, 2003, 02:32 PM
#17
Re: Re: Re: ?..
Originally posted by Joacim Andersson
MoveFirst followed by MoveNext should result in him standing on the the second record, right? In his origional post he said he didn't (though he probably is since he has duplicats in hid DB).
thats what im sayin
-
Apr 15th, 2003, 02:46 PM
#18
Let me in ..
Sorry guys, i thought he was talking about MovePrevious.
-
Apr 15th, 2003, 02:47 PM
#19
Yeah but according to his origional question he was still standing on the first record after calling MoveNext.
-
Apr 15th, 2003, 02:49 PM
#20
Let me in ..
Well, he should probably put a text box on the form and do this ...
on each movenext ...
text1.text = Recordset.AbsolutePosition
this will at least tell him whether recordset is moving or not ....
-
Apr 15th, 2003, 03:01 PM
#21
Thread Starter
Fanatic Member
...I gave a false explanation
My fault..
I gave a hasty and false assertion of what I thought was going on
So...
Thanks all for responding...
On another note....[to change the subject]
What a beautiful day it is around here!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|