472,114 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,114 software developers and data experts.

display all records from a table

subashini Thiyagarajan
Hi all,

i have just displayed all the records from one table of access database.it is very easy right. Now....... i have given sort by option on the top using list box.when we select any item from the list box it will compare with the column data and where the same content is there in any record,only those records it display.everything working fine..


now my problem is without selecting any content it is defaultly selecting the last search and displaying those records.......................pls help, at the intial stage (i mean without any selection) all records should get displayed.


How to do??????????????????
Mar 19 '07 #1
4 1340
jhardman
3,406 Expert 2GB
now my problem is without selecting any content it is defaultly selecting the last search and displaying those records.......................pls help, at the intial stage (i mean without any selection) all records should get displayed.
First check that your query statement is correct. It sounds like the query is keeping the wrong info.

Jared
Mar 20 '07 #2
Hi,
My query is this


"select * from tablename where columnname=" & selection

Intially selection is nothing so it supposed to show all records.but for me intial stage as soon as the page displays it automatically takes the first selection and showing the details.
in select option i have not specified any selected near any option


could u help me?
Mar 20 '07 #3
jhardman
3,406 Expert 2GB
That looks good, I always use the "SELECT * " as well no matter what I pull up.

I have done something very similar to the project you described. I was listing books by different authors, but instead of the user selecting a sort field from a drop down list I put a link in each table header, so under the field "title" or "author" or whatever, I put a link to [HTML]<a href="datalister.asp?sort=author">Author</a>[/HTML] When I create the query statement I say:
Expand|Select|Wrap|Line Numbers
  1. query = "SELECT * FROM works"
  2. if request("sort") = "" then
  3.    query = query & " ORDER BY title"
  4. else
  5.    query = query & " ORDER BY " & request("sort")
  6. end if
  7.  
  8. 'the next line will be commented out in the final version:
  9. response.write query & "<br>" & vbNewLine
There is a lot that can go wrong with any query statement, so I print the query as a matter of fact now until everything is up. I would first try to eliminate the possibility that the query string is being written wrong. Try to get the table to display incorrectly AND show the actual query string and you might be able to catch the problem, or at least eliminate that possibility.

Does that make sense?

Jared
Mar 20 '07 #4
jhardman
3,406 Expert 2GB
Ok, now that I re-read your post, I see that you are using your selection drop down box to add a "where" clause, and I was using it to add an "order by" clause, but my answer is still the same: try to get the error AND print the query string.

Jared
Mar 20 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by dennis.joseph | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.