Ciao Adam,
what thinBasic version are you using? I've recently changed a lot ADODB module, so please download and install thinBasic 1.10.4 from here: http://www.thinbasic.com/community/s...inBasic-1-10-x
I've tryed to simulate your script and here it seems to work fine with few little changes:
Uses "ADODB"Uses "Console"
Dim objConnection As ADODB_CONNECTION
Dim objRecordSet As ADODB_RECORDSET
Dim ConnectionDetails, SQL As String
Dim SegmentNames(9999) As String
Dim SegmentCt As Integer
Dim FieldCt As Integer
ConnectionDetails = "Provider = Microsoft.ACE.OLEDB.12.0; Data Source = " & app_sourcepath & "Table Space History.accdb"
objConnection = New ADODB_CONNECTION
objRecordSet = New ADODB_RECORDSET
objConnection.Open(ConnectionDetails)
'---If connection is open then Executes a command and print some data
If objConnection.State = %ADSTATEOPEN Then
SQL = "Select * from SegmentNames"
objRecordSet.Open SQL, objConnection, %ADOPENSTATIC, %ADLOCKOPTIMISTIC, %ADCMDTEXT
If objRecordSet.RecordCount > 0 Then
Console_WriteLine("Records Extracted = " & objRecordSet.RecordCount)
Console_WriteLine(objRecordSet.Fields.Count)
objRecordSet.MoveFirst
Console_WriteLine(objRecordSet.Fields(1).Value)
SegmentCt = 0
while Not objRecordSet.EOF
SegmentCt = SegmentCt + 1
printl SegmentCt
SegmentNames(SegmentCt) = objRecordSet.Fields(2).Value
for FieldCt = 1 to objRecordSet.Fields.Count
printl objRecordSet.Fields(FieldCt).Name , "=", objRecordSet.Fields(FieldCt).Value
Next
objRecordSet.MoveNext
Wend
Else
Console_WriteLine("No records extracted")
End If
objRecordSet.Close
objConnection.Close
Else
long nError
If objConnection.Errors.Count Then
PrintL "--> Error happened:" In %CCOLOR_FLIGHTRED
For nError = 1 to objConnection.Errors.Count
PrintL "Error number..:", objConnection.Errors(nError).Number
PrintL "Description...:", objConnection.Errors(nError).Description
PrintL "Source........:", objConnection.Errors(nError).Source
PrintL "SQLState......:", objConnection.Errors(nError).SQLState
PrintL "NativeError...:", objConnection.Errors(nError).NativeError
Next
'---Clear all errors so new errors will restart to fill Errors collection
objConnection.Errors.Clear
End If
end If
printl "---Press a key to end---"
WaitKey
Attached the script and an access DB I've tried to replicate to simulate your script
Let me know.
Eros
Bookmarks