Retrieving non-string values
chuck hinkle
chuckbo at hinkles.us
Wed Jan 14 13:35:17 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
>
I still get the Type Mismatch error when I try to compile it.
I'm guessing that it's because I can't set an Integer variable equal to
the result of the UShortfield command; integers are 4 bytes and vushort
fields are 2 bytes. But what RB field type would be appropriate to use? Do
I need to move it into a Variant?
chuck
More information about the Valentina
mailing list