array in record set

Results 1 to 3 of 3

Thread: array in record set

  1. #1
    Join Date
    Dec 1969

    Default array in record set

    Hi ,<BR><BR>I have the following situation<BR><BR>I have an array in a record set<BR><BR>let us say<BR><BR>strsql1 = select * from tableOne<BR><BR>recordset1 = exec strsql1<BR><BR>while not recordset1.eof<BR><BR>strSQL2 = select * from tabletwo where field1 = recordset1.fields("fieldone")<BR>recordset2 = exec strSQL<BR>while not recordset2.eof<BR>array1 = recordset2.getrows<BR>recordset2.movenext<BR>wend< BR>recordset1.movenext<BR>wend.<BR>-----when I do the followingin the while loop, i get all the values----<BR><BR>for i=0 to ubound(array1, 2)<BR>for j=0 to ubound(array1, 1) <BR>response.write array1(j,i)<BR>next<BR>next<BR><BR>I want to get the same values for the array outside while loop. but it returns only last value. How to do this?. Help please.<BR><BR>thanks you<BR>Mvaddey<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default Oh dear no.

    If you are looking into the 2nd recordset for records that match the first, why don&#039;t you just JOIN the tables together?

  3. #3
    Join Date
    Dec 1969

    Default Wrong terminology

    You most certainly do *NOT* have an "array in a record set."<BR><BR>You have a recordset that has been *CONVERTED* to an array. Which is not at all the same thing.<BR><BR>On top of that, when you use <BR> array1 = recordset2.getrows <BR>you just converted *ALL* the records in the *ENTIRE* recordset to one array. And you are now *guaranteed* to be at the EOF of the recordset. Period.<BR><BR>On top of that, the entire coding style is bogus. You should *never* get an "inner" recordset every time through a loop on the outer recordset. You should use a SQL JOIN query and get *ONE* (total!) recordset.<BR><BR>So throw out your code and redesign it. To use one recordset and get ONE array.<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