Retrieving non-string values
Charles Yeomans
yeomans at desuetude.com
Wed Jan 14 14:06:23 CST 2004
On Jan 14, 2004, at 1:38 PM, chuck hinkle wrote:
>
>
> I don't know why I continue to be confused by this topic; it doesn't
> seem
> like it should be difficult.
>
>
> I have a table with a variable in it named Vsize, and it's defined as a
> vuShort. In my RB program, I'm having trouble moving it to a variable
> dimensioned as an integer.
>
> I know that if my variable were a string, I could use
> VSize = my_cursor.field("VSize").getstring
>> From what I read, it seems like I need to do
> VSize = vushort(my_cursor.field("VSize")) but that gives me a Type
> Mismatch error (perhaps because I'm trying to move a vushort to an
> integer?).
>
> Any advice on this one?
> chuck
>
You should use my_cursor.UShortField("VSize").value, which returns an
integer. Beware that calling one of these functions (like UShortField)
on a field of the wrong type usually results in a crash, so you might
consider adding an assertion before it that checks the type of
my_cursor.Field("VSize"), at least for debug builds.
Charles Yeomans
More information about the Valentina
mailing list