Navigate RecordSet
am 30.05.2005 08:01:46 von rhamada
I need to navigate a recordset like first, prior, next and last
commands.
How can I do that?
I am trying to do like this:
rs.cursortype = 2
rs.open sql, connection
rs.movefirst
rs.find("ID=105")
but I got this error "Rowset does not support scrolling backward." in
the last line.
Thanks.
Re: Navigate RecordSet
am 30.05.2005 09:28:21 von Jon
This looks like it may be because your recordset object doesn't support
bookmarks or backwards cursor movements. Simple as that!
Though how to get around it or to make it support either of these two I'm
not completely sure. You could try another method of navigating using the
move command like this:
objRecordset.Move 0,adBookmarkFirst
Let me know if this helps!-- Jonwarpedpixel@gmail.comLook at that dead pixel
on your screen! *SLAP* Gotcha! wrote in message
news:1117432906.130329.293910@g43g2000cwa.googlegroups.com.. .
>I need to navigate a recordset like first, prior, next and last
> commands.
> How can I do that?
>
> I am trying to do like this:
>
> rs.cursortype = 2
> rs.open sql, connection
>
> rs.movefirst
> rs.find("ID=105")
>
> but I got this error "Rowset does not support scrolling backward." in
> the last line.
>
> Thanks.
>
Re: Navigate RecordSet
am 30.05.2005 15:38:30 von reb01501
rhamada@gmail.com wrote:
> I need to navigate a recordset like first, prior, next and last
> commands.
> How can I do that?
>
> I am trying to do like this:
>
> rs.cursortype = 2
> rs.open sql, connection
>
******************************************
> rs.movefirst
This line is not needed - if the recordset contains records, the cursor is
already pointed at the first record immediately after opening.
******************************************
> rs.find("ID=105")
>
> but I got this error "Rowset does not support scrolling backward." in
> the last line.
>
> Thanks.
2 is a dynamic cursor, which should support bookmarks and scrolling. What is
the database? What does your connection string look like (ODBC or OLE DB)?
What is the result of
response.write sql
?
The provider may not be able to supply the cursor type you specified. After
opening the recordset, what is the result of:
response.write rs.cursortype
Frankly, a dynamic cursor is a little expensive - you should not have a
recordset open long enough to care about changes made by other users. A
static cursor should suit most purposes. In fact, if you must use a
recordset (and your use of Find does seem to indicate that that is what you
need - normally I would prefer a GetRows array), you should use a
client-side static cursor and disconnect it from the database (allowing you
to close your connection as soon as possible) before working with it:
rs.cursorlocation = 3 'adUseClient
rs.open sql, connection
set rs.activeconnection = nothing
connection.close: set connection = nothing
rs.find("ID=105")
etc.
'close & destroy your recordset when finished working with it.
HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"