If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Item cannot be found in the collection corresponding to the requested name or ordinal

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-15-04, 14:55
darkform darkform is offline
Registered User
 
Join Date: Mar 2004
Posts: 7
Item cannot be found in the collection corresponding to the requested name or ordinal

Hi all,

My problem:
When I use the following code, I get "unspecified error". And when I debug the code using "response.write", I get "ADODB.Recordset (0x800A0CC1)Item cannot be found in the collection corresponding to the requested name or ordinal."

The code is simply trying to get a single data from a form and write it down to the access database. I'm pretty sure that all the spellings are correct. Anyway, here is the code:

-----------------------------------------------------------
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open Server.MapPath("../../../db/denizbaris.mdb")
set Katalog=Server.CreateObject("ADODB.recordset")

SQL = "Select * from CATALOG where ID = "& Request("ID")

conn.execute (SQL)

Katalog("COMPANY_ID") = Request("COMPANY_ID")

Katalog.Update
Katalog.Close
Set Katalog = Nothing
-----------------------------------------------------------

Any help ?
thanx,
Baris
Reply With Quote
  #2 (permalink)  
Old 03-15-04, 16:25
vextout vextout is offline
Registered User
 
Join Date: Jan 2003
Location: New York
Posts: 160
SQL = "Select * from CATALOG where ID = "& Request("ID")
should be
SQL = "Select * from CATALOG where ID = '"& Request("ID") & "'"

put quotes around it
__________________
Beyond Limitation
Reply With Quote
  #3 (permalink)  
Old 03-15-04, 17:37
darkform darkform is offline
Registered User
 
Join Date: Mar 2004
Posts: 7
thanx,

Got "(0x80004005) Unspecified error" again.

And when I try debugging with response.write, "I again get Item cannot be found..." again.

Also tried this:
Set Katalog = conn.execute(SQL)
and again I got "unspecified error"

I'm pretty sure that I gave all the permissions to all the folders as unspecified error is a security issue. But it won't work also.

totally stuck-up...

thanx,
Baris
Reply With Quote
  #4 (permalink)  
Old 03-15-04, 17:57
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
the error you are getting generally means it can't find the field you are refering to....

try this to get more info on what is happening...

Code:
on error resume next

set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open Server.MapPath("../../../db/denizbaris.mdb")
set Katalog=Server.CreateObject("ADODB.recordset")

SQL = "Select * from CATALOG where ID = "& Request("ID")

conn.execute (SQL)

if katalog.eof then
  response.write "No records found matching the ID "& Request("ID")
end if

for each field in katalog.fields
  response.write "Fieldname: " & field.Name & "<br>"
next

Katalog("COMPANY_ID") = Request("COMPANY_ID")

Katalog.Update
Katalog.Close
Set Katalog = Nothing
the first added bit will let you know if any records are coming back.

the second bit should (assuming my guess at the methods etc are correct) loop through the fields in the recordset and print out the field names. this will let you ensure you are looking for the right field in your recordset.

hth
Reply With Quote
  #5 (permalink)  
Old 03-15-04, 20:08
darkform darkform is offline
Registered User
 
Join Date: Mar 2004
Posts: 7
Yo rokslide thanx,

I still got the "unspecified error".
This time on debugging with the response.write, I got:
"Operation is not allowed when the object is closed"
on line 9, which is the one you've added: "for each field in katalog.fields".

this is getting more confusing... how the hell it gets closed when I do not close it...

Anyway, I should also mention that all the site is going well with zero problems, as well as opening, retrieving and writing data to any and all tables and fields, EXCEPT that CATALOG table. I can retrieve any data from it, but WRITING on it (CATALOG table) is somehow impossible.

my 2 cents
Baris
Reply With Quote
  #6 (permalink)  
Old 03-15-04, 20:28
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
errgghhhh,... of course....

you have....
Code:
conn.execute (SQL)
Katalog("COMPANY_ID") = Request("COMPANY_ID")
you should have
Code:
Katalog = conn.execute (SQL)
Katalog("COMPANY_ID") = Request("COMPANY_ID")
you are not actually setting your recordset to the response from the execution of the command.
Reply With Quote
  #7 (permalink)  
Old 03-15-04, 20:43
darkform darkform is offline
Registered User
 
Join Date: Mar 2004
Posts: 7
Tried it also. And the result is: "unspecified error" (shit)

I'm now using this code:


Function ConConnect()

Set Conn = Server.CreateObject("ADODB.Connection")

Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Inetpub\wwwroot\rehber\db\denizbaris.mdb ;"

End Function

ConConnect()

Set Katalog = Server.Createobject("Adodb.Recordset")
SQL = "Select * from CATALOG where ID = "& Request("ID")
Katalog.Open SQL, conn, 1, 3 '<---- UNSPECIFIED ERROR AGAIN


I'm using this one this time because I've used the same code for all the complete site. As I said before I got no errors until now. just writing something in that CATALOG table is impossible. Maybe I've done something wrong in MS Access while creating the table ?

hell...

peace
Baris
Reply With Quote
  #8 (permalink)  
Old 03-16-04, 15:10
darkform darkform is offline
Registered User
 
Join Date: Mar 2004
Posts: 7
RESERVED WORD

It took me a week to handle it, EVEN tho I knew that there were some "RESERVED WORD"s

I tried 56432943289 variations of connecting to the database but somehow it was impossible. Here is that's why:

Remember the table that I can retrieve info from but can't write anything in it. Name of that table was "CATALOG"

CATALOG is a reserved word for ODBC !

So then, How can it be possible to retrieve info from a table named mistakenly with a reserved word ? I never thought that it maybe a reserved word, B'couse the table is working when retrieving info. That idea faked me toooooooo good... (So do you also tho)

Got too much headace after this mind-blowing week. Gonna have some sleep now...

check all the reserved words here if you also need:
http://www.aspfaq.com/show.asp?id=2080

Thanx everyone,
peace,
Baris
Reply With Quote
  #9 (permalink)  
Old 03-16-04, 15:40
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
Errrr,... you're uses oledb, not odbc.... either way, you are probably right...

In MS SQL you could put square brackets around the word and that should see you right,.. not sure with Access....
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On