Using variables in recordset object

Results 1 to 2 of 2

Thread: Using variables in recordset object

  1. #1
    Chris Roos Guest

    Default Using variables in recordset object

    I have a table in a database with fields 1 through 18, each having a pointer to another table in the same database. I need to enumerate the 18 fields, get the values and query the second table with the current id, read certain data from the table into variables and then repeat for all other fields in the original table.<BR><BR>eg.<BR><BR>sqlRecords = "SELECT * FROM featured"<BR>rsSearch.Open sqlRecords, dataConn<BR>rsSearch.MoveFirst<BR>iCounter = 1<BR>While NOT rsSearch.EOF<BR> response.write rsSearch(i) &#060; * Want this to read variable value so that i can then reference in a seperate sql statement<BR> iCounter = iCounter + 1<BR> rsSearch.MoveNext<BR>Wend<BR><BR>Please Help.

  2. #2
    Join Date
    Dec 1969

    Default RE: Using variables in recordset object

    Like This ? ...<BR><BR>&#060;% sqlRecords = "SELECT * FROM featured"<BR>rsSearch.Open sqlRecords, dataConn<BR>Do While NOT rsSearch.EOF<BR>For i = 1 to 18 <BR>response.write rsSearch(i) <BR>next i <BR>rsSearch.MoveNext<BR>Loop %&#062;<BR><BR>You&#039ll probably need to convert i to a string if actual names of your fields are "1", "2", ... "18" <BR><BR>I would suggest naming your fields like "Feature1", "Feature2", etc. then you can do this ...<BR><BR>For i = 1 to 18 <BR>response.write rsSearch("Feature" & i )<BR>Next i<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts