Hi !
-----Original Message-----
From: Jeetandra Mahtani <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Wednesday, April 07, 1999 5:43 AM
Subject: getting to the last record
>Hello,
>I have a table with five fields, the first/primary
>field being an id no. Now when I want to insert a
>record, I need to get to the last record, get the
>last records id no and add 1 to it. I can use this
>result for inserting my next record. Is there a
>method to get to the last record?
>Appreciate it.
>Thanks,
>J
If the last record is the max. of all other ( I supose it is
because you want to add 1 to it)
You should try something like this
rs=stmt.executeQuery(" SELECT MAX(id) from tablename ");
It realy depends on want Database are you using but it must be
somenthing like MAX
If not get them all and remember only the last one :)))))))
My best wishes,
Andras
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html