KB-65651: Using the GetAsyncADORecordSet method.

Question:

How can I use a Query’s GetAsyncADORecordSet method?

Solution:

The GetAsyncADORecordSet method creates a Query that, once finished, generates the Query’s OnAsyncQueryFinish event, passing to this event the generated result (Recordset).

Unlike GetADORecordSet method, in this case the script doesn’t ‘hang’ while the query’s result hasn’t been loaded. This is a good option for accessing records from a Query that returns too much data, and even to minimize the effects of a database whose performance is compromised.

Below, there is an example of script using this method:

Firing the asynchronous query:

Sub CommandButton10_Click()
Set Query = Screen.Item("E3Browser1").Item("Query1")
Query.GetAsyncADORecordset()
End Sub

Records returned in OnAsyncQueryFinish event:

Sub Query1_OnAsyncQueryFinish(Recordset, Error)
IF error <> true then
Set RS = Recordset
RS.MoveFirst()
For i=1 to RS.Recordcount
a1 = RS.Fields("Field").Value
a2 = RS.Fields("Field2").Value
strValues = strValues & a1 & " " & a2 & Chr(13)
RS.MoveNext()
Next
Msgbox strValues
End IF
End Sub

 

Attachments:

GetAsync.zip

 

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *