How to go last record in a table ?

General discussion on OpenOffice Base and its databases.

How to go last record in a table ?

Postby Elwood M. Walker » Tue Jun 03, 2014 7:56 am

Hi guys.
I want to go last record and get a column value from one column in a table. I tried these

Code: Select all
Function last_row as integer
Result = Statement.executeQuery("SELECT number FROM CUSTOMER")
Result.last   ' I tried "Result.last()" , "Result.Last() ", "Result.Last"
last_row=Result.getInt(1)
End Function

I get this error message code:
Type: com.sun.star.sdbc.SQLException
Message: ResultSet was set to forward only.

How can I solve this problem?
Any suggest great welcome
Thank you for your help
Elwood M. Walker
 
Posts: 33
Joined: Mon Mar 24, 2014 6:09 am

Re: How to go last record in a table ?

Postby Champ_AN » Tue Jun 03, 2014 10:12 am

Hi,

Code: Select all
Function last_row as integer
    Result = Statement.executeQuery("SELECT ""number"" FROM CUSTOMER")
    while not Result.isLast
        Result.next
    wend
    last_row=Result.getInt(1)
End Function


I hope this will help you..
thanks,
Champ_AN
 
Posts: 19
Joined: Tue Mar 25, 2014 6:34 am


Return to OpenOffice.org Base

Who is online

Users browsing this forum: No registered users and 0 guests

cron