I’m trying to loop through an array, doing a odbcResultset.execute with a different sql statement each time, but…
it don' work
here’s the (pseudo) code…
Dim conHAPL As New ODBCConnection
conHAPL.ConnectTo(“hapl”)
If Not conHAPL.IsConnected Then
Print "No Connection to DB: hapl"
Exit Sub
End If
conHAPL.SilentMode = True ’ we don’t want to be bothered by popups
Dim qryAllWhatever As New ODBCQuery
Set qryAllWhatever.Connection = conHAPL
Dim resResultSet As New ODBCResultSet
…[get stuff, like an array of strings called varTableList]
Forall x In varTableList
sTableName = Cstr(x)
qryAllWhatever.SQL = "SELECT * FROM " & sTableName
Set resResultSet.Query = qryAllWhatever
If Not resResultSet.Execute Then
Print resResultSet.GetExtendedErrorMessage,,resResultSet.GetErrorMessage
Exit Sub
End If
… [process the result set]
resResultSet.Close(DB_CLOSE)
If conHAPL.IsConnected Then
bFlag = conHAPL.Disconnect
End If
End Forall ’ x in varTableList
This works fine for the first element of varMetaData, but the second time around resResultSet.Execute is false, but the error messages are…
NO ERROR 500 NO ERROR
Like it’s fine, just false. Bah humbug!
I’ve tried calling resResultSet.Close after I’ve finished with it, without that, putting the dim’s inside the loop, disconnecting the conHAPL, lots of things.
So I’m left with the question:- Can I actually do this?
Kind regards
Tim