Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The result set behaviour

 
Amit Tiwary
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The result set I am using to fetch data from a table in MS-Access following the query "select * from fun",is fetching the recors but not sequentially from data base? How do I fix that?
Thanx in adv
Amit
 
Kirtikumar Puthran
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
select * from fun",is fetching the recors but not sequentially from data base? How do I fix that?

What do you mean by sequential. If you have a primary key defined in the table 'fun', then the above query will return results in order of that primary key column as that column will be indexed.
Hope this helps.
Rgds,
Kirtikumar Puthran
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Amit,
As Kirtikumar says, "what do you mean by sequentially?" If you mean that you want the result set of your query to be sorted, then as far as I know, no database (including MS Access) returns a sorted result set from a database query -- unless the query includes an ORDER BY clause.
In other words, in order to get a sorted result set back for your database query, it should be something like:

Although I haven't verified Kirtikumar's claim (and I would like to know if he has), I don't think he is correct.
Hope this helps you.
Good Luck,
Avi.
 
Kirtikumar Puthran
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Avi,
In MS Access, when you open a database in Design View, there is a parameter known as "Indexed" for each column.
The values of this parameter are:
No(Default)
Yes(Duplicates OK)
Yes(No Duplicates)
If the above query from Amit has to return results in a sorted order, then the Indexed parameter of the column has to be YES.
Rgds,
Kirtikumar Puthran
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic