Results 1 to 2 of 2

Thread: Array

  1. #1
    Join Date
    Dec 1969

    Default Array

    Here is my code : <BR> "Select DISTINCT Navn from Table", objconn<BR>X = 0<BR>do while not objrs.eof<BR> MyArray(x) = objRs(0)<BR> X = X + 1<BR> objrs.movenext<BR>loop<BR>objrs.close<BR><BR>Im trying to place result of query in array but it&#039;s not working, tryed :<BR>response.write MyArray(0) <BR>and<BR>for x = 0 to uboound(MyArray)<BR> response.write MyArray(x)<BR>next<BR><BR>To show information in array, I get Type mismatch: &#039;MyArray&#039;<BR><BR>What am I doing wrong ?<BR><BR>Btw, I havnt declared Myarray coz have no idea how big it will be.<BR>

  2. #2
    Join Date
    Dec 1969

    Default try this....

    you need to use the getrows method....<BR><BR>Dim DataArray<BR><BR>If Not RS.EOF And not RS.BOF Then DataArray = RS.GetRows<BR>RS.Close<BR>Conn.Close<BR>Set RS = Nothing<BR>Set Conn = Nothing<BR>For i = LBound(DataArray, 2)<BR> &#039; DataArray is a 2 dimensional array:<BR> &#039; 1st dimension corresponds to the fields of the RS<BR> &#039; 2nd dimension corresponds to the records of the RS<BR>Next<BR><BR>hope this helps.<BR><BR>jb

Posting Permissions

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