Hi,

I have recently started using ThinBasic and have been attempting to use the ADODB module to read data from ACCESS and ORACLE database tables. I am able to connect to the databases and run some SQL and using the RecordSet ObjectCount I can see that rows are being returned but as soon as I try and access the data using the Fields(x).Name and Fields(x).Value a pop-up appears saying ‘thinbasic.exe has stopped working’ and if I then select Debug ‘An unhandled WIN32 exception occurred in thinbasic.exe (10040)’. It is running on Windows 7 32 bit.

An example script below – this gets to the line ‘Console_WriteLine(objRecordSet.Fields.Count)’ and then the pop-up appears.

Has anyone else had this issue?

Uses "ADODB"
Uses "ADO"
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 = h:\My Documents\Access\Table Space History.accdb"

objConnection = New ADODB_CONNECTION
objRecordSet = New ADODB_RECORDSET

objConnection.Open(ConnectionDetails)

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
Do Until objRecordSet.EOF
SegmentCt = SegmentCt + 1
Console_WriteLine(SegmentCt)
SegmentNames(SegmentCt) = objRecordSet.Fields(2).Value
objRecordSet.MoveNext
Loop
Else
Console_WriteLine("No records extracted")
End If

objRecordSet.Close
objConnection.Close


Thanks

Adam