【vfp开源代码栏目提醒】:网学会员,鉴于大家对vfp开源代码十分关注,论文会员在此为大家搜集整理了“自动更新.prg”一文,供大家参考学习!
CLEAR
CLOSE DATABASES ALL
LOCAL oCursor as CursorAdapter,aErrors[1]
OPEN DATABASE HOME(2)+"Data\TestData" SHARE
USE Customer ALIAS Customer SHARED IN 0
oCursor=NEWOBJECT("CursorAdapter")
*!* 属性设置
WITH oCursor
.AllowDelete=.T.
.AllowInsert=.T.
.AllowUpdate=.T.
.Alias="curCustomer"
.BufferModeOverride=5
.DataSourceType="Native"
.SelectCmd="SELECT Cust_ID,Company,Contact FROM Customer WHERE Country='Brazil'"
.KeyFieldList="Cust_ID"
.Tables="Customer"
.UpdatableFieldList="Cust_ID,Company,Contact"
.UpdateNamelist="Cust_ID Customer.Cust_ID,"+;
"Company Customer.Company,Contact Customers.Contact"
.SendUpdates=.T.
.ConflictCheckType=3
ENDWITH
IF oCursor.CursorFill()
*REPLACE Company WITH "China Construction Bank" FOR Customer.Cust_ID="FAMIA"
BROWSE
IF TABLEUPDATE(.T.)=.F.
=MESSAGEBOX("更新失败!",0+48,"提示")
ENDIF
ELSE
AERROR(aErrors)
=MESSAGEBOX(aErrors[2])
ENDIF