FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Im stuck with ASP





mathew
Hello,

Im making myself a website and i'm putting a photos page on it. I am using paging to display the photos 10 per page, but i'm getting an error that i cant seem to debug...

Anyone have any ideas

The error is from the red underlined line...

Quote:

Response.Write vbCrLf

' Continue with a title row in our table
Response.Write "<table border=""0"">" & vbCrLf

' Show field names in the top row
Response.Write vbTab & "<tr>" & vbCrLf
For I = 0 To oRS.Fields.Count - 1
response.write "</tr>"
Response.Write "<tr><td><a href='displaygroup.asp?group=" & oRS("group") & "'><img src='photos/" & oRS("photo") & ".jpg' width='80' height='60'></a>"
Response.Write "<br><a class='photodetail' href='displaygroup.asp?group=" & oRS("group") & "'>" & oRS("group") & "</a>"
Response.Write "</td>"
Next 'I
Response.Write vbTab & "</tr>" & vbCrLf

' Loop through our records and ouput 1 row per record
iRecordsShown = 0
Do While iRecordsShown < iPageSize And Not oRS.EOF
Response.Write vbTab & "<tr>" & vbCrLf
For I = 0 To oRS.Fields.Count - 1
Response.Write vbTab & vbTab & "<td>"
Response.Write oRS.Fields(I)
Response.Write "</td>" & vbCrLf
Next 'I
Response.Write vbTab & "</tr>" & vbCrLf

' Increment the number of records we've shown
iRecordsShown = iRecordsShown + 1
' Can't forget to move to the next record!
oRS.MoveNext
Loop

' All done - close table
Response.Write "</table>" & vbCrLf
End If


The fields are present in the database and contain text... the photo files (*.jpg) are in the correct folder (but I dont think that really matters...)

My SQL string to select from the database is
Quote:

strSQL = "SELECT DISTINCT group AND photo FROM photo WHERE pass='mypassword'"
set oCN = server.createobject("ADODB.Connection")
oCN.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
& Server.Mappath("db/homepg.mdb")
set oRS= oCn.execute( strSQL )



I'm not hosting this page on Frihost by the way...

Thanks in advance for any help
n0obie4life
Moved to scripting.
Jiltedcitizen
Well whats the error?

And your SQL is wrong. AND isn't use'd likt that. SELECT DISTINCT group, photo FROM Photo WHERE WHERE pass='mypassword'
mathew
The error is
Quote:



ADODB.Recordset error '800a0cc1'

Item cannot be found in the collection corresponding to the requested name or ordinal.

/mathewlyons/test/photos.asp, line 102


Thanks for the help!
Jiltedcitizen
Ya thats a SQL error. Take out that and. Should work then.
mathew
Bump
Jiltedcitizen
Still not working?
frozenhead
mathew wrote:
The error is
Quote:



ADODB.Recordset error '800a0cc1'

Item cannot be found in the collection corresponding to the requested name or ordinal.

/mathewlyons/test/photos.asp, line 102


Thanks for the help!


Here's what you do. First, check on the page photos.asp then go to line 102.

Item cannot be found in the collection corresponding to the requested name or ordinal.
- a general error where you might mispelled an table index name or accessing an index from a table that doesn't exist. Compare the index names from your database to the code above. Wink
Jiltedcitizen
I still think its the sql, 'and' isn't used like that. A comma should be there.
Related topics
stuck in Rainbox 6: Vegas 2
crazy frog
Problems with ftp access
GTA: San Andreas PC (OFFICIAL THREAD)
What is your graphics card?
Network and printer issues (two seperate problems)
BIOS
Stick RPG Anyone?
Best Photoshop Pic
So You Think You Are INTELLIGENT eh ? Try this :)
Cash Mod
New Year Plans
What's your Video Card?
How to become a millionaire on the internet?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.