Re: how can i move to the last record of recordset
- From: Till <tillstoschus@xxxxxxxxxx>
- Date: Sun, 17 Dec 2006 11:30:34 +0100
Am Mon, 04 Dec 2006 05:28:09 -0800 schrieb ashwinijain:
i have one table in MS. Access in which i am storing company details.
i want to create an unique company id for each company.
so i want to aceess the last row in the table to generate next id
I am using last() method but its throwing sqlexception.
rs=stat1.executeQuery("Select Company_id from Company ");
// Code
if(rs!=null)
{
rs.last();
no=rs.getInt(1) + 1;
}
else
no=1;
you could use "order by company_id asc" in the sql-statement and take
the first row of the resultset.
concerning the Exception: are there any records in the resultset ?
.
- References:
- how can i move to the last record of recordset
- From: ashwinijain
- how can i move to the last record of recordset
- Prev by Date: ODBC Connection
- Next by Date: Re: Problem with jdbc, RowSet and Oracle
- Previous by thread: Re: how can i move to the last record of recordset
- Next by thread: Server-side cursors for ResultSets - a pattern? (and what about Oracle?)
- Index(es):