Skip to main content
Participating Frequently
March 1, 2007
Answered

Recordset syntax

  • March 1, 2007
  • 14 replies
  • 862 views
Hi there. I'm having some problems with the proper syntax for retrieving a recordset.

the normal call dreamweaver generates: <%= (rsOrder.Fields.Item("UserEmail").Value) %>

however I'm looping through an array where the field is represented by a variable. My question is what would the proper syntax be to accomplish this?

thanx ahead of time
This topic has been closed for replies.
Correct answer Creativ_Technologies
I believe the error is happening with the use of the replace function in your select statement. For example Replace(rsOrder__filterField, "'", "''"); this would be the results

before replace: "ID"
after replace: ""ID""

I think you may be adding too many quotations, you don't need quotations around your column names in your select statement. Also, your filter fields needs to equal something. It doesn't look like your filter fields are being compared to anything. Therefore you have too few parameters.

Make sure you only use the replace function when you actaully need to replace something.

14 replies

NetCompAuthor
Participating Frequently
March 2, 2007
thats did it! Thanx again for hanging in there.....I appreciate it.

what part of the world are you in? I thought I was the only person that worked at 3:00 am!
Inspiring
March 2, 2007
I am in Boise, Idaho. How about you?

Anyways, I never go to sleep before 1:00 am. I am a night owl.
NetCompAuthor
Participating Frequently
March 2, 2007
I'm in a small town in SW Ontario, 20 min from Lake Erie


hope your weather is better than ours right now!
Creativ_TechnologiesCorrect answer
Inspiring
March 2, 2007
I believe the error is happening with the use of the replace function in your select statement. For example Replace(rsOrder__filterField, "'", "''"); this would be the results

before replace: "ID"
after replace: ""ID""

I think you may be adding too many quotations, you don't need quotations around your column names in your select statement. Also, your filter fields needs to equal something. It doesn't look like your filter fields are being compared to anything. Therefore you have too few parameters.

Make sure you only use the replace function when you actaully need to replace something.
NetCompAuthor
Participating Frequently
March 2, 2007
he, he yeah I tried that. I think the problem is occuring in the select statement...if you have a look at the source again of the select statement, is there anything in there that looks wrong in terms of how I'm getting the WHERE params?

the error message I'm getting now is "Too few parameters"

thanx for hanging in there with me!
Inspiring
March 2, 2007
Okay, after testing multiple solutions this one worked for me, and I believe it is very similar to what you have.

<% for x = 0 to ubound(myArray)%>
<td><%=rsTest.fields.item(myArray(x)).value%></td>
<%next%>

I really don't know why yours wasn't working, unless the values in your array weren't matching with what was in the DB.
Inspiring
March 2, 2007
Okay, I am close to solving your first problem with the array. I should have that solution for you in a few minutes. The second problem with the recordset just means that what ever criteria you are filtering by is not returning any results thefore the recordset is empty.
NetCompAuthor
Participating Frequently
March 2, 2007
Yeah I think its the filterFields that I'm having the problem with.

Request.Form("FilterFields") looks something like this UserID=1,UserFirstName=Rob

I then use Replace(Request.Form("FilterFields"),","," AND ") to get it into UserID=1 AND UserFirstName=Rob for the WHERE statement.
NetCompAuthor
Participating Frequently
March 2, 2007
sorry I guess I'm leaving out some parts of the picture, heres the source.

http://www.lumberlinkonline.com/temp/test.txt

Inspiring
March 2, 2007
Does the recordset return a result when you test it, or is it filtered by something?
Inspiring
March 2, 2007
Oh I think I understand now. Try placing the array in quotes rs.fields.item("arrHeadings(i)").value
Inspiring
March 1, 2007
sorry, had to run to the store. Try this then:

<% For i=0 to uBound(arrHeadings) %>
<td align="center"><%= arrHeadings(i)%></td>
<% Next %>
NetCompAuthor
Participating Frequently
March 2, 2007
that I can do...but I'm trying to substitute the variable for the actual field value it represents.
Inspiring
March 1, 2007
That looks fine. Just make sure that the strings in arrHeadings match the
column names returned by your recordset.

"NetComp" <webforumsuser@macromedia.com> wrote in message
news:es74f1$pdo$1@forums.macromedia.com...
> thanx for the quick reply. this is what I'd like to do:
>
> <% For i=0 to uBound(arrHeadings) %>
> <td align="center"><%= (rsOrder.Fields.Item(cstr(arrHeadings(i))).Value)
> %></td>
> <% Next %>


NetCompAuthor
Participating Frequently
March 2, 2007
I'm getting this error with that code: Requested operation requires a current record

The field names all match up but for some reason its not picking it up??