ASP page navigation through Access database?

Without the movenext it'll get stuck in a loop and never come out of it (not reaching the .eof).

The error you are getting is an incorrectly named item in the recordset, which means there's a typo somewhere in the field names.

Try replacing them with their ordinal position instead:

Rs(0)
Rs(1)

etc...and see if that helps.

As a final note, if you are expecting more than 3 or 4 people to use the website at the same time, I would highly recommend NOT using MS Access, but using MySQL or SQL Express instead (both are free).
 
Mr^B said:
Rs(0)
Rs(1)

etc...and see if that helps.

Sorry, not sure what you mean by that ... could you explain further?

I'm only learning ASP and using MS Access due to using it in work and wanting to know all the in's and out's of it .. once I've learnt it properly I'll move onto something more advanced.

I'm going to get a book on this soon, just trying to start understanding the basics at the moment like connecting to a database, unfortunatly with not nothing much in the way of microshafts way of doing things then I'm not getting very far at the moment :-/

Thanks for all the help so far though
 
This is the line that is causing the error:

Code:
Response.Write "<a href=" & Rs("PageFile") & ">" & Rs("PageTitle") &"</a>"

The missing ordinal means that it can't find "PageFile" or "PageTitle" as columns returned from this query:

Code:
SELECT * from pages ORDER BY PageID

The column names you specify as part of the Rs("...") command need to match the column names in the table (pages).

You can refer to the columns by their position ("ordinal") by doing this:

Code:
Response.Write "<a href=" & Rs(0) & ">" & Rs(1) &"</a>"

Which will return the first and second columns respectively (0 based array).

If that's all a bit like doublt-dutch, if you can show us the structure of the table, we can tell you what's going wrong.
 
Mr^B said:
If that's all a bit like doublt-dutch, if you can show us the structure of the table, we can tell you what's going wrong.

I can understand it ok, but for future reference I'd rather just use the actual column names.

My database is as follows:

PageID | PageTitle | PageFile
1 | Home | home.asp
2 | Pictures | pictures.asp
3 | Floorplan | floorplan.asp

etc...

I've just released though that I don't want the pages in different files, I want one the one div to determine which page the user is at then put the relevant data into each <p></p> or <img></img> tag. Still, for now I'd like to get a database linked up.

Edit: Just tried putting in 2 and 1 and its working fine :), I'm going to give it a rest now though until the book i've ordered arrives

Thanks for all the help everyone,

Steven
 
Last edited:
Back
Top Bottom