• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

to retrive the last row

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
how to retrieve the last added row,without using query.there is one keyword. can any one tel me the keyword for that one.
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can use Last() method to moves your cursor to the last row in the ResultSet object. see Java Doc here.
 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you want any records other than the last? If you just want the last record I'd reorganize the query so that it selects only a single record.
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Muhammad Saifuddin:
you can use Last() method to moves your cursor to the last row in the ResultSet object. see Java Doc here.

The last row in a Resultset object might not be the last added row.
The requestor will first have to define the criterea that determine the last added row.
Using the highest auto-generated record ID might not help, because several databases pool sequence IDs, and do not guarantee that these IDs are used in order.
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just write the query appropriately depending on your database design, although why you would want to do this is beyond me...it's better to use exact criteria rather than being arbitrary such as "last updated row"
[ March 26, 2008: Message edited by: Kevin Smither ]
 
bakiyalakshmi dhanraj
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In one interview there ask this question,that's why i ask u
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by bakiyalakshmi dhanraj:
In one interview there ask this question,that's why i ask u


Sometimes an interviewer wants to see how you think rather than an exact answer. It could be they were looking to see if you would suggest a better design.
reply
    Bookmark Topic Watch Topic
  • New Topic