CrazyEngineers
  • resultset sort in java

    krp31

    Member

    Updated: Oct 26, 2024
    Views: 1.1K
    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'.
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Manish Goyal

    MemberMar 29, 2010

    I think you can do this easily by modifying query
    why don't you use "order by"
    Are you sure? This action cannot be undone.
    Cancel
  • sookie

    MemberApr 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 ! 😀
    Are you sure? This action cannot be undone.
    Cancel
  • krp31

    MemberApr 5, 2010

    unable to post replies !!!!
    Are you sure? This action cannot be undone.
    Cancel
  • krp31

    MemberApr 5, 2010

    ven i paste my matter in "quick reply", page comes up saying "page not found"
    Are you sure? This action cannot be undone.
    Cancel
  • Kaustubh Katdare

    AdministratorApr 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
    Are you sure? This action cannot be undone.
    Cancel
  • csiscool

    MemberApr 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..
    Are you sure? This action cannot be undone.
    Cancel
  • sookie

    MemberApr 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". 😀
    Are you sure? This action cannot be undone.
    Cancel
  • krp31

    MemberApr 13, 2010

    i'm not even able to send a "private message" of my matter to the admin. what is the problem??
    Are you sure? This action cannot be undone.
    Cancel
  • krp31

    MemberApr 13, 2010

    even if i retype the whole thing here, it still shows the same annoying page
    Are you sure? This action cannot be undone.
    Cancel
  • Kaustubh Katdare

    AdministratorApr 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.
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register