>>>Hello,
>>>
>>>I was wondering how I could get a Uniqueness of Index Violation
>>>just by issuing a seek() command. I am new to FoxPro but I thought
>>>that the seek command just searched for a value rather than try to
>>>commit changes.
>>>The code is simple:
>>> select payment
>>> set order to pay_pk
>>> seek(x)
>>>When I pull up the debugger the line that causes the error is the
>>>seek() command.
>>>
>>>Any Ideas?
>>>
>>>Thanks,
>>>
>>>Paul Acton
>>>Tri-Technical Systems, Inc.
>>
>>If you have Row Buffering, TableUpdate will be enforced implicitly any time you move record pointer.
>
>I haven't explicitly set Row Buffering, However I am using Visual
>Maxframe Professional and it may have. I was wondering if there is
>some command in VFP that will clear the Buffer so that I can move
>the record pointer without comitting the changes. Would it make
>sense to issue TableRevert() right before issuing the seek()?...Or
>is this a bad programming practice?
>I have included the code I am working with:
>
>select cpayment
>SCAN
> DO CASE
> CASE cpayment.cpay_update = "A"
> lnPK = X3GENPK("PAYMENT","LS")
> IF isnull(lnPK)
> =messagebox("Primary Key not Created")
> ELSE
> select payment
> append blank
> replace pay_pk with lnPK
> replace pay_acct with student.stu_acct
> replace pay_sub with student.stu_sub
> replace pay_last with student.stu_last
> replace pay_schdate with cpayment.cpay_schdate
> replace pay_lessdate with cpayment.cpay_lessdate
> replace pay_paydate with cpayment.cpay_paydate
> replace pay_amt with cpayment.cpay_paid
> ENDIF
> CASE cpayment.cpay_update = "C"
> select payment
> set order to pay_pk
> seek(cpayment.cpay_pk)
> if found() = .f.
> =messagebox("Payment Record not Found")
> else
> replace pay_schdate with cpayment.cpay_schdate
> replace pay_lessdate with cpayment.cpay_lessdate
> replace pay_paydate with cpayment.cpay_paydate
> replace pay_amt with cpayment.cpay_paid
> endif
> OTHERWISE
> ENDCASE
>ENDSCAN
>
>Thanks,
>
>Paul Acton
If you use buffering you can issue either tableupdate() or tablerevert() to clear the buffer. Also you could use Cursorgetprop() to check what kind of buffering (if any) you have.
Edward Pikman
Independent Consultant