OO4O: Fields-collection problem
Date: Mon, 15 Mar 1999 11:50:24 +0100
Message-ID: <36ECE5F0.622A110A_at_hotmail.com>
[Quoted] I have a problem with the Oracle Objects for OLE 2.3 Fields collection.
Please have a look at the included VB5 code sample. I marked two statements with "<<<<< !!!!!!"
Tia,
Pascal
'Declare variables as OLE Objects.
Dim OraSession As OraSession
Dim OraDatabase As OraDatabase
Dim OraDynaset As OraDynaset
Dim Flds() As Object
Dim iFieldCount As Integer
Dim iCounter As Integer
Dim strListItem As String
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
Set OraDatabase = OraSession.DbOpenDatabase("thedbshortname", "something/somethingelse", 0&)
Set OraDynaset = OraDatabase.DbCreateDynaset("select * from cy", 0&)
iFieldCount = OraDynaset.Fields.Count 'iFieldCount returns 6 <<<<< !!!!!!
ReDim Flds(0 To iFieldCount - 1)
For iCounter = 0 To iFieldCount - 1
Set Flds(iCounter) = OraDynaset.Fields(iCounter)
Next iCounter
Do Until OraDynaset.EOF
strListItem = ""
For iCounter = 0 To iFieldCount - 1
'When iCounter reaches 4 I get an "Invalid use of
Null"-error <<<<< !!!!!!iCounter reaches 5 there's no problem
'When I skip the execution of the statement with iCounter = 4 and
strListItem = strListItem + Flds(iCounter).Value + vbTab Next
List1.AddItem (strListItem)
OraDynaset.dbmovenext
Loop
-- [Pascal Dussart [Volvo Europa Truck] B-9041 Ghent]Received on Mon Mar 15 1999 - 11:50:24 CET