resultset sort in java

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

  • Manish Goyal
    Manish Goyal
    I think you can do this easily by modifying query
    why don't you use "order by"
  • sookie
    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 ! 😀
  • krp31
    krp31
    unable to post replies !!!!
  • krp31
    krp31
    ven i paste my matter in "quick reply", page comes up saying "page not found"
  • Kaustubh Katdare
    Kaustubh Katdare
    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
    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
    @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
    i'm not even able to send a "private message" of my matter to the admin. what is the problem??
  • krp31
    krp31
    even if i retype the whole thing here, it still shows the same annoying page
  • Kaustubh Katdare
    Kaustubh Katdare
    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.

You are reading an archived discussion.

Related Posts

I'm designing a fuel injector test rig and I need to know the procedure for "selecting a motor" that'd drive a pump to create 250 bar and discharge 60 cc/400...
Google partners in China are likely to follow billionaire Li Ka-shing's lead and cut links with the US Internet company after it defied the nation's self-censorship rules. Li's Tom Online...
he world’s most-used internet browser, Microsoft’s Internet Explorer, is on a steady decline in India, reveals a study by Irish Top 10 internet passwords How to get better @ Twitter...
Source: HTML5 | Brightcove Its obviously irritating that Apple's iPad does not allow Flash. But no need to worry. Brightcove already has a technology to help you watch videos on...
It might be difficult to find CEans who are using twitter. So I'm thinking about collecting IDs of CEans who are on Twitter so that we can follow each other...