[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Retrieving data from SQL through variables

Posted on 2009-02-16
2
Medium Priority
?
206 Views
Last Modified: 2012-05-06
Hi all,

I can't seem tp figure out this error message saying "Item cannot be found in the collection corresponding to the requested name or ordinal."

Normally i would use:
sData = sData & Chr(34) & "" & (rsGetData.Fields.Item("MYFIELDHERE").Value) & "" & Chr(34) & ","

But beucase all the fields are in an array which i am looping round, i am trying to do this:
sData = sData & Chr(34) & "" & (rsGetData.Fields.Item(myArray(i)).Value) & "" & Chr(34) & ","

But i am getting the error message "Item cannot be found in the collection corresponding to the requested name or ordinal.". I have checked each field and it is deffinatly in the select statement. There is no room for a typo as it is all from the database.

Anyone know how i can edit the below code to make it work? Not sure if i'm missing anything?

Thanks in advance!
sData = sData & Chr(34) & "" & (rsGetData.Fields.Item(myArray(i)).Value) & "" & Chr(34) & ","

Open in new window

0
Comment
Question by:previewservices
  • 2
2 Comments
 

Author Comment

by:previewservices
ID: 23651857
Just changed to code so i to see the fields that is outputing.

sData = sData & Chr(34) & " (rsGetData.Fields.Item(" & myArray(i) & ").Value) & " & Chr(34) & ","      
SELECT imagename, doctab.text1, doctab.text2, doctab.text27, doctab.date1, doctab.text3, doctab.text4, doctab.text5, doctab.text6, doctab.text7, doctab.text8, doctab.text9, doctab.text28, doctab.text10, doctab.text11, doctab.text12, doctab.text29, doctab.text13, doctab.text14, doctab.text15, doctab.text16, doctab.text17, doctab.text18, doctab.text19, doctab.text20, doctab.text21, doctab.text22, doctab.text23, doctab.text24, doctab.text25, doctab.text26 from doctab where doctab.text4='MR'
 
 
" (rsGetData.Fields.Item(imagename).Value) & "," (rsGetData.Fields.Item(doctab.text1).Value) & "," (rsGetData.Fields.Item(doctab.text2).Value) & "," (rsGetData.Fields.Item(doctab.text27).Value) & "," (rsGetData.Fields.Item(doctab.date1).Value) & "," (rsGetData.Fields.Item(doctab.text3).Value) & "," (rsGetData.Fields.Item(doctab.text4).Value) & "," (rsGetData.Fields.Item(doctab.text5).Value) & "," (rsGetData.Fields.Item(doctab.text6).Value) & "," (rsGetData.Fields.Item(doctab.text7).Value) & "," (rsGetData.Fields.Item(doctab.text8).Value) & "," (rsGetData.Fields.Item(doctab.text9).Value) & "," (rsGetData.Fields.Item(doctab.text28).Value) & "," (rsGetData.Fields.Item(doctab.text10).Value) & "," (rsGetData.Fields.Item(doctab.text11).Value) & "," (rsGetData.Fields.Item(doctab.text12).Value) & "," (rsGetData.Fields.Item(doctab.text29).Value) & "," (rsGetData.Fields.Item(doctab.text13).Value) & "," (rsGetData.Fields.Item(doctab.text14).Value) & "," (rsGetData.Fields.Item(doctab.text15).Value) & "," (rsGetData.Fields.Item(doctab.text16).Value) & "," (rsGetData.Fields.Item(doctab.text17).Value) & "," (rsGetData.Fields.Item(doctab.text18).Value) & "," (rsGetData.Fields.Item(doctab.text19).Value) & "," (rsGetData.Fields.Item(doctab.text20).Value) & "," (rsGetData.Fields.Item(doctab.text21).Value) & "," (rsGetData.Fields.Item(doctab.text22).Value) & "," (rsGetData.Fields.Item(doctab.text23).Value) & "," (rsGetData.Fields.Item(doctab.text24).Value) & "," (rsGetData.Fields.Item(doctab.text25).Value) & "," (rsGetData.Fields.Item(doctab.text26).Value) & ",

Open in new window

0
 

Accepted Solution

by:
previewservices earned 0 total points
ID: 23657320
Figured it. it was outputing "tablename.fieldname" when asp only supports "fieldname"
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question