SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old May 10th, 2001, 07:15 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
Display last record from database

<i><b>Originally posted by : Ly (hwatts@hotmail.com)</b></i><br /><br />Hi,<br /><br /> I try to display the last record from database by using:<br /> 1. RS.movelast before response.write<br /> It gave the error message:<br />Error Type:<br />Microsoft OLE DB Provider for ODBC Drivers (0x80040E24)<br />Rowset does not support fetching backward.<br /><br /> 2. Then I try another way by:<br />Select id,info from table order by id<br /> It's displayed the first record instead of last.<br /><br />Can any one help.<br />Thanks,<br /><br />Ly

Reply With Quote
  #2  
Old May 11th, 2001, 05:36 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
<i><b>Originally posted by : </b></i><br />Try..<br />Select id,info from table order by id desc<br />Bye<br />Jyothsna<br /><br />------------<br />Ly at 5/10/2001 5:15:33 PM<br /><br /><br />Hi,<br /><br /> I try to display the last record from database by using:<br /> 1. RS.movelast before response.write<br /> It gave the error message:<br />Error Type:<br />Microsoft OLE DB Provider for ODBC Drivers (0x80040E24)<br />Rowset does not support fetching backward.<br /><br /> 2. Then I try another way by:<br />Select id,info from table order by id<br /> It's displayed the first record instead of last.<br /><br />Can any one help.<br />Thanks,<br /><br />Ly

Reply With Quote
  #3  
Old May 21st, 2001, 05:39 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
<i><b>Originally posted by : Fred Schenk</b></i><br />Or, more efficient:<br /><br />SELECT TOP 1 id,info FROM table ORDER BY id DESC<br /><br />if you only want the last one...<br /><br />Gtx,<br /> Fred<br /><br />------------<br /> at 5/11/2001 3:36:13 PM<br /><br />Try..<br />Select id,info from table order by id desc<br />Bye<br />Jyothsna<br /><br />------------<br />Ly at 5/10/2001 5:15:33 PM<br /><br /><br />Hi,<br /><br /> I try to display the last record from database by using:<br /> 1. RS.movelast before response.write<br /> It gave the error message:<br />Error Type:<br />Microsoft OLE DB Provider for ODBC Drivers (0x80040E24)<br />Rowset does not support fetching backward.<br /><br /> 2. Then I try another way by:<br />Select id,info from table order by id<br /> It's displayed the first record instead of last.<br /><br />Can any one help.<br />Thanks,<br /><br />Ly

Reply With Quote
  #4  
Old October 14th, 2003, 11:48 AM
m_lazor m_lazor is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Luxembourg
Posts: 156 m_lazor User rank is Corporal (100 - 500 Reputation Level)m_lazor User rank is Corporal (100 - 500 Reputation Level)m_lazor User rank is Corporal (100 - 500 Reputation Level)m_lazor User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
No, no. You must be using adForwardOnly as a connection param. And at the same time you must already be beyond the end of the recordset so that MoveLast means actually move back by one position.

1) change conn params so they support scrolling backwards
2) Did you check for EOF? If your recordset doesn't contain records you are at EOF which is again beyond the last record and MoveLast would ask to move backwards

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Display last record from database


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT