Re: OO4O: Fields-collection problem

From: TimKArnold <timkarnold_at_aol.com>
Date: 15 Mar 1999 14:36:04 GMT
Message-ID: <19990315093604.00659.00000998_at_ng-fx1.aol.com>


You need to test for NULL before doing anything with flds(icounter). eg.
if not isnull(flds(icounter)) then......

regards,
Tim

>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 <<<<< !!!!!!
> 'When I skip the execution of the statement with iCounter = 4 and
>iCounter reaches 5 there's no problem
>
> 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 - 15:36:04 CET

Original text of this message