This is a discussion on "Stepping backward through a query" within the Classic ASP section. This forum, and the thread "Stepping backward through a query are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Stepping backward through a query
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Stepping backward through a query
Hello!
Just wading through a university assignment and i have come accross a problem, i am sure you guys will spot the problem straight away, i need to step backwards through the recordset of a query any ideas welcomed,,, thanks this is the code <% dim adOpenForwardOnly, adLockReadOnly,adCmdTable adOpenStatic=3 adLockReadOnly =1 adCmdTable=2 dim objConn, objRS, objCommand set objCommand = Server.CreateObject("ADODB.Command") set objConn=Server.CreateObject("ADODB.Connection") set objRS=Server.CreateObject("ADODB.Recordset") objRS.CursorType=adOpenStatic objCommand.ActiveConnection= strConnect objCommand.CommandText= "piccomments" objCommand.CommandType= adCmdTable set objRS = objCommand.Execute set objCommand=Nothing Response.Write PicsToTable(objRS) objRS.Close Set objRS = Nothing Set objConn = Nothing %> |
|
|
|
||||
|
Looking for these?
ObjRS.MoveFirst ObjRS.MovePrevious ObjRS.MoveNext ObjRS.MoveLast
__________________
Rob - SEO Specialist Owner & Founder of Webforumz.com I am currently unavailable for private work
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
|
|||
|
Make sure you have the right cursor type. I've no idea though because I never use open recordsets. Too slow.
|
|
|||
|
What I want to do is skip to the end of the recordset
objRS.MoveLast and then read them out backwards objRS.MovePrevious until BOF=true but it says that i cannot go in reverse, i can do it with objRS.open but not objCommand.Execute what is the faster alternative to recordsets? |
|
||||
|
Disconnected recordsets is what you are after.
Let me see if i can find my code library.....
__________________
Rob - SEO Specialist Owner & Founder of Webforumz.com I am currently unavailable for private work
Last Blog Entry: Creative Labs threaten developer over home made drivers.... (Apr 1st, 2008)
|
|
||||
|
Quote:
if you don't use open recordsets, then what do you use? do you save the recordsets as files and then re-open them? is that faster? ps.: I know it's a bit out of topic but I really wanna know!!!!!!!!!
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
|||
|
as Rob quite rightly pointed out Disconnected Recordsets are the best thing to use for this scenario.
There is a useful article on Disconnected Recordsets here http://www.4guysfromrolla.com/webtech/080101-1.shtml which describes it a lot better than I could |
|
||||
|
just what I thought.
so you can disconnect the recordset once it's been loaded and still access the information retrieved...
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
|||
|
why not just use GetRows() to put the recordset into an array then step through the array bottom-to-top?
|
|
||||
|
getrows() wouldn't work for me because I still want to use some of the features of the recorset object: RecordCount, PageSize, PageCount, Filter, etc.
so disconnecting is a better idea...
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
|||
|
As with any of the programming i have ever done, i get to a point and then realise i could do the whole lot better if i could be bothered to rewrite it all.
I will just use a SQL statement to order by reverse date. Its for diary type entries. So this also means i wont have to add them in any particular order. Thanks anyway |
![]() |
| Tags |
| stepping, backward, through, query |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Nav bar query | Scottie | Starting Out | 10 | Jun 9th, 2008 21:23 |
| query about my $query | ziggi | PHP Forum | 9 | Aug 10th, 2007 14:05 |
| MySQL query query | dangergeek | Databases | 3 | Apr 12th, 2007 12:45 |