[V4RB] 3 simple [?] questions
Keith DeLong
delong at redcort.com
Wed Feb 26 07:35:33 CST 2003
Hi Pedro,
> Three questions that I suspect are all rather simple matters but I
> haven't found answered in the Valentina docs.
>
> 1. Closing vCursor ... With READdb I found that it is absolutely
> crucial that RecordSets be explicitly closed when finished with. I
> started porting my project planning to follow similar practice with
> Valentina but haven't found any way to explicitly close a vCursor. Is
> it necessary? If so how is it done? With cur = nil?
Yep - cur = nil is what you'll want to destroy cursors that are not dimmed
local to a method.
> 2. Dates. I'd like to display dates as a REALbasic ShortDate because
> that formats the date according to the users system preferences.
> Currently I'm doing that with the following ...
>
> d = new date
> d.year = data.DateField( "dateAdded" ).year
> d.month = data.DateField( "dateAdded" ).month
> d.day = data.DateField( "dateAdded" ).day
> efDateAdded.text = d.shortDate
>
> Can anyone suggest a more concise approach?
I use doubles instead of dates in V4RB... For base object, I'd use:
d = new date
d.totalseconds = data.MyDateDouble.value
It's really much better to use cursors:
d.totalseconds = cursor.doublefield("MyDate").value
cursor.add //or cursor.update
> 3. I have a listbox that will used display at 4 different sets of
> fields. I'd like, if possible, to populate it with a generic block of
> code rather than a block for each set of fields. Am I correct in
> believing that ...
>
> cur.field( indexOrName ).getString
> will return the field contents as a string for all or most field types?
Correct. GetString is simply doing the string conversion for you. I use this
all the time for listbox population. It's pretty fast in my tests.
HTH,
Keith DeLong
More information about the Valentina
mailing list