469,920 Members | 2,224 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,920 developers. It's quick & easy.

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 1251
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
By using this site, you agree to our Privacy Policy and Terms of Use.