Public Sub Async_Exec(ByVal myConnection As DbConnectionBase)
Dim myCommand As DbCommandBase = myConnection.CreateCommand()
myCommand.CommandText = "SELECT Id, Name, Type FROM Folders"
Console.WriteLine("Starting asynchronous retrieval of data...")
myConnection.Open()
Dim cres As IAsyncResult = myCommand.BeginExecuteReader(Nothing, Nothing)
If cres.IsCompleted Then
Console.WriteLine("Completed.")
Else
Console.WriteLine("Have to wait for operation to complete...")
End If
Dim myReader As DbDataReader = myCommand.EndExecuteReader(cres)
Try
While myReader.Read()
Console.WriteLine(String.Concat(myReader.GetInt32(0).ToString(), " ", myReader.GetString(1), " ", myReader.GetString(2)))
End While
Finally
myReader.Close()
myConnection.Close()
End Try
End Sub