skyler99
asked on
ASP / Item cannot be found in the collection corresponding to the requested name or ordinal
I know you guys have seen this error message before; Most of the field names have a space between them. For Example: Job id, add no, telf no... etc. I don't know how to define them on this statement:
response.write("<option value=""" & rs("job id") & """>")
I've already tried to put [] around "job id", also I removed the quotes around it but it doesn't work. Do you have any other ideas??
ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the requested name or ordinal.
response.write("<option value=""" & rs("job id") & """>")
I've already tried to put [] around "job id", also I removed the quotes around it but it doesn't work. Do you have any other ideas??
ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the requested name or ordinal.
jmar is correct, field names should never contain spaces and most tech-types will turn green/purple if they see it (although it is technically valid in many DBs, MS Access immediatley springs to mind but query via DAO/ADO/.NET wil usually require the field wrapped in square brackets when referencing)
If you must Separate words in a field use an underscore '_' character but preferably do it Correctly 'JobID' or 'EmployeeName'.
However in this case one or more of these solutions may work but most likely the third one
response.write("<option value=""" & rs("[job id]") & """>")
response.write("<option value=""" & rs("job id").value & """>")
response.write("<option value=""" & rs("[job id]").value & """>")
in your example you are actually returning the field *object* rather than the *value* of the field.
If you must Separate words in a field use an underscore '_' character but preferably do it Correctly 'JobID' or 'EmployeeName'.
However in this case one or more of these solutions may work but most likely the third one
response.write("<option value=""" & rs("[job id]") & """>")
response.write("<option value=""" & rs("job id").value & """>")
response.write("<option value=""" & rs("[job id]").value & """>")
in your example you are actually returning the field *object* rather than the *value* of the field.
ASKER
This is an Access database 2000.
I just try this.
response.write("<option value=""" & rs(0).value & """>") ...it works fine.
I just try this.
response.write("<option value=""" & rs(0).value & """>") ...it works fine.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
oops that should obviously say....
for t=0 to rs.fields.count -1
reponse.write "<br>" & rs(t).name & "<br>"
next t
for t=0 to rs.fields.count -1
reponse.write "<br>" & rs(t).name & "<br>"
next t
I feel that i had offered most contribution but @ 25 points, really not that fussed.
Try referencing it with rs("job")