resultset sort in java

krp31

krp31

@krp31-Vyku5U Oct 26, 2024
hi all, as being from VB background, java seems alot different. i have an issue to be solved in java in connection with MS access. i'm getting the data from the table in the resultset say 'rs'. now i need to sort it in descending either by date or by primary key & later delete all the entries which come after 10 entries.

i'm unable to know how to sort my 'rs'.

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Manish Goyal

    Manish Goyal

    @manish-r2Hoep Mar 29, 2010

    I think you can do this easily by modifying query
    why don't you use "order by"
  • sookie

    sookie

    @sookie-T06sFW Apr 4, 2010

    Hi krp,

    A Hint: Create a class that contains your resultset data including those fields that are needed to sort the data. Use Comparable interface of Java to compare the objects and store all objects of resultset data class as a collection or Array and then sort it. And deletion also you can easily do on "Collections"

    Hope it helps ! 😀
  • krp31

    krp31

    @krp31-Vyku5U Apr 5, 2010

    unable to post replies !!!!
  • krp31

    krp31

    @krp31-Vyku5U Apr 5, 2010

    ven i paste my matter in "quick reply", page comes up saying "page not found"
  • Kaustubh Katdare

    Kaustubh Katdare

    @thebigk Apr 5, 2010

    krp31
    ven i paste my matter in "quick reply", page comes up saying "page not found"
    Hit the 'Go Advance' button below Quick Reply box and wrap your code in
     ... [ /code] tags without space between [ and / . If the problem persists, send the content to admin [at] crazyengineers [dot] com
  • csiscool

    csiscool

    @csiscool-qA5mGA Apr 9, 2010

    sookie
    Hi krp,

    A Hint: Create a class that contains your resultset data including those fields that are needed to sort the data. Use Comparable interface of Java to compare the objects and store all objects of resultset data class as a collection or Array and then sort it. And deletion also you can easily do on "Collections"

    Hope it helps ! 😀
    he can sort with just using the query as goyal said..
  • sookie

    sookie

    @sookie-T06sFW Apr 11, 2010

    @csiscool Yes you are right he can do the same by modifying query but it will not allow deletions. For deletion, he will have to make another query and let us assume other query is also allowed but that query will result in deletions of records from the database(not from the result set). Using collections will not affect database records. It will only do manipulations on result set. At last I will say only 1 thing "Solution always depend on the actual problem and requirements". 😀
  • krp31

    krp31

    @krp31-Vyku5U Apr 13, 2010

    i'm not even able to send a "private message" of my matter to the admin. what is the problem??
  • krp31

    krp31

    @krp31-Vyku5U Apr 13, 2010

    even if i retype the whole thing here, it still shows the same annoying page
  • Kaustubh Katdare

    Kaustubh Katdare

    @thebigk Apr 13, 2010

    krp31
    even if i retype the whole thing here, it still shows the same annoying page
    The 'page not found' problem has been solved. If you are still facing the errors, please send the contents of the post you are trying to make to admin[at] crazyengineers [dot] com. I'll have a closer look.