Retrieving object pointers
Fred.Stephenson
Fred.Stephenson at communication-unltd.com
Tue Nov 4 18:16:04 CST 2003
>I tried out some code last night but ran into problems. I don't understand
>as much as I thought I did.
>
>I have this code
>
> SQL = "Select * from Components order by Component_name"
SQL="Select recid, * from Components order by Component_name"
> MyCursor = app.myDB(SQL, kv_client, kv_ReadOnly, kV_ForwardOnly)
>
> RecordCount = MyCursor.RecordCount
> rc = MyCursor.FirstRecord
> for RHO = 1 to recordCount
> This_component.Component_name =
>MyCursor.field("Component_name").getstring
> <snip>
> This_component.component_pointer = Mapcursor.field("recID").getstring
That's because you don't have the "recid" in your sql (see above)
>
> At this point I get a NilObjectException.
> I'm unclear where recID comes from. Is this a reserved word? It isn't a
>property in my table. Should I be trying to use GetrecID on the
>Components table instead?
> BTW, I have component_pointer defined as string. Is this correct, since
>I have to use getstring, even though the pointer is a vULLong?
No, as Ruslan pointed out earlier you don't need to have it as a string
D_Ecurs.ULongfield("EPtr").value = Ecurs.ULongField("recid").value
all the best
Fred
More information about the Valentina
mailing list