Results 1 to 2 of 2

Thread: sql & arrays

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2001
    Location
    UK
    Posts
    99

    sql & arrays

    i have posted like 3-4-5 time asking the same question but no one seems to anser it!
    i have made a connection to my database(sql2k), redimed my arrrays
    now all i need is the code to take all the infomation in a columb and dump it into a array, so
    i have a colubm with 12 cells, my array size is 12
    one cell to a slot in the array
    ergo
    cell1 in stock code columb------>array1(0)
    cell2 in stock code columb------>array1(1)
    i could really do with help on this please help me im gonna be in big trouble if i dont get help

  2. #2
    Hyperactive Member mvrp350's Avatar
    Join Date
    Feb 2001
    Location
    Best, the Netherlands
    Posts
    322
    Do a recordcount, after you have opened the recordset you use the redim function and put the data in the array:

    VB Code:
    1. dim YourArray() as string
    2. dim intCntr as integer
    3. dim i as integer
    4.  
    5. intCnt = YourRecordset.recordcount
    6.  
    7. Redim YourArray(intCnt)
    8.  
    9. YourRecordset.movefirst
    10. for i = 1 to intCnt
    11. YourArray(i) =YourRecordset("YourField")
    12. YourRecordset.movenext
    13. next i

Posting Permissions

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



Click Here to Expand Forum to Full Width