AW: AW: AW: RecID from Cursor

Keith DeLong delong at redcort.com
Tue Feb 15 15:46:46 CST 2005


Hi Chuck,
You guys are correct, n is the field order in the select statement. As a
matter of habit I always select RecID first since the RecID in the cursor
has to be accessed using the field number rather then the field name.
Otherwise you'll find yourself hard coding the position in the select
statement or calculating n using cursor.fieldcount. Either way is extremely
fragile and crashes RB if you change your select statement later on and
forget to change the RecID order.

So if if you always SELECT RecID, Field1, etc., in RB you can use the
following with confidence and not worry if you modify the select statement
later on: 

recIDInteger = cursor.ULongField(1).Value
   or 
RecIDString = cursor.field(1).getstring

Hope this helps,
Keith DeLong


> True...if my understanding is not in error.
> 
> Regards,
> 
> Chuck
 
> On Feb 15, 2005, at 1:38 PM, Florian Bogeschdorfer wrote:
> 
>> You could also use
>> 
>> SELECT RecID, * FROM ...
>> 
>> Then it would be first again.
>> 
>> Florian
>> 
>>> -----Ursprüngliche Nachricht-----
>>> Von: valentina-bounces+fb=memedia.de at lists.macserve.net
>>> [mailto:valentina-
>>> bounces+fb=memedia.de at lists.macserve.net] Im Auftrag von Chuck Pelto
>>> Gesendet: Dienstag, 15. Februar 2005 21:35
>>> An: Valentina Developers
>>> Betreff: Re: AW: AW: RecID from Cursor
>>> 
>>> Maybe not, Florian,
>>> 
>>> This is more like SQL than RB. The question is that with your
>>> suggested
>>> syntax for the SQL query, SELECT *, RecID.....
>>> 
>>> ...the star means all fields. Right? Putting a comma and "RecID" after
>>> the star, seems to me to indicate All Fields + RecID. The placement
>>> would be all the fields in the table followed by the RecID field.
>>> 
>>> According to Ruslan's comment about going after the field number where
>>> the RecID is found, (1) in his first example and (3) in his second, it
>>> seems logical to me that if the RecID is being tacked onto the end of
>>> all the other fields, that the value of n could be determined by a
>>> call
>>> of curs.FieldCount. Then use n in the call of...
>>> 
>>> recID = curs.ULongField(n).Value()
>>> 
>>> Regards,




More information about the Valentina mailing list