[V4RB] updating records ... where am i going wrong?

Ruslan Zasukhin sunshine at public.kherson.ua
Wed May 14 13:31:05 CDT 2003


on 5/12/03 10:25 PM, Pedro fp at lists at pedro.net.au wrote:

>>    dim i As integer, c As vCursor, b As boolean, nNew, nCur As double
>>    dim newPhase, newDuration As vDouble
>> 
>>    c = mDatabase.SQLselect( "SELECT phase1, duration FROM moon ORDER BY
>> phase1" ) ' WHERE RecID > 0
>> 
>>    if c.recordCount > 0 then
>> 
>>      ' Assign cursor fields to variables.
>>      newPhase = c.doubleField( "phase1" )
>>      newDuration = c.doubleField( "duration" )
>>        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ VERY GOOD :-)
>> 
>>      for i = 1 to ( c.recordCount - 1 )
>>        c.currentPosition = i + 1 ' Go to the record ahead.
>>            nNew = newPhase.value ' Get the next new moon.
>>        c.currentPosition = i ' Go back to the current record.
>> 
>>        nCur = newPhase.value ' Get the current new moon.
>>        newDuration.value = nNew - nCur ' Set duration as the
>> difference.
>>        c.Update()

Hi Pedro,

One more tip.

IF you can use NextRecord() PrevRecord()
Better use them.

This is LITTLE faster than
    c.currentPosition = i + 1
    c.currentPosition = i - 1

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list