Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: MoveLast


Message #1 by "John P. Miller" <jpmiller@a...> on Mon, 23 Jul 2001 16:09:55 -0400
I need to get the value of the last record in an auto number field from 

my database. I'm trying to do this using the MoveLast command. I keep 

getting this error:



Rowset does not support fetching backward



My code is:



<% Set OBJdbConnection =3D Server.CreateObject("ADODB.Connection")

OBJdbConnection.Open "Resa-1"

SQLQuery3 =3D "Select Order_No from repaccs3"

Set RSGetLast =3D OBJdbConnection.Execute(SQLQuery3)

%>

<% rsGetLast.MoveLast %>





Help?



John Miller

jpmiller@a...

Message #2 by "John Miller" <jpmiller@a...> on Mon, 23 Jul 2001 21:24:48
I need to get the value of the last record in an auto number field from my 

database. I'm trying to do this using the MoveLast command. I keep getting 

this error:

 

Rowset does not support fetching backward

 

My code is:

 

<% Set OBJdbConnection = Server.CreateObject("ADODB.Connection")

OBJdbConnection.Open "Resa-1"

SQLQuery3 = "Select Order_No from repaccs3"

Set RSGetLast = OBJdbConnection.Execute(SQLQuery3)

%>

<% rsGetLast.MoveLast %>

 



Help?

 

John Miller

jpmiller@a...
Message #3 by "Ken Schaefer" <ken@a...> on Tue, 24 Jul 2001 12:19:02 +1000
www.adopenstatic.com/faq/fastestautonumber.asp

if you want to get the newly inserted autonumber



If you just want to get the highest one, but you don't want to do anything

with it, then use:



SELECT Max(IDField) FROM tablename



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

----- Original Message -----

From: "John Miller" <jpmiller@a...>

To: "ASP Web HowTo" <asp_web_howto@p...>

Sent: Monday, July 23, 2001 9:24 PM

Subject: [asp_web_howto] MoveLast





: I need to get the value of the last record in an auto number field from my

: database. I'm trying to do this using the MoveLast command. I keep getting

: this error:

:

: Rowset does not support fetching backward

:

: My code is:

:

: <% Set OBJdbConnection = Server.CreateObject("ADODB.Connection")

: OBJdbConnection.Open "Resa-1"

: SQLQuery3 = "Select Order_No from repaccs3"

: Set RSGetLast = OBJdbConnection.Execute(SQLQuery3)

: %>

: <% rsGetLast.MoveLast %>






  Return to Index