Results 1 to 2 of 2

Thread: order recordset

  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i use this query to filter an ordering a recordset.
    After i use the getrow statement.
    during the loop in the records the ordering is lost!
    Why?
    In effect to speed up the looping in the recordset, and i think is a good idea, to store the recordset in a variant array and lopp in, or not?

    Code:
    ORECO.CursorLocation = adUseClient
    SQL = "Select * From " & T_TABELLE & " WHERE DATA_RIFERIMENTO='" & Format(DATA, "MM/DD/YYYY") & "' ORDER BY COD_AGENZIA_4"
    ORECO.Open SQL, OCONN, adOpenKeyset, adLockOptimistic, adCmdText
    
    NUMERO_RECORDS = ORECO.RecordCount
    ORECO.MoveFirst
    VALORI = ""
    VALORI = ORECO.GetRows
    
    ORECO.Close
    Set ORECO = Nothing
    OCONN.Close
    Set OCONN = Nothing
    
    NUMERO_RECORDS = UBound(VALORI, 2)
            
    For intRecord = 0 To UBound(VALORI, 2)
    TEST_AG = ""
    TEST_AG = VALORI(0, intRecord)
    TEST_AG = VALORI(1, intRecord)
    TEST_AG = VALORI(2, intRecord)
    TEST_AG = VALORI(3, intRecord)
    TEST_AG = VALORI(4, intRecord)
    TEST_AG = VALORI(5, intRecord)
    TEST_AG = VALORI(6, intRecord)
    AVANTI = AVANTI + 1
    Next

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    GetRows should preserve the sort order of the recordset, in this example by COD_AGENZIA_4.
    Please check carefully.

    I'm not sure that reading the recordset into an array will speed up execution. The entire recordset will have to be read anyway.


Posting Permissions

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