CLOSE DATABASES ALL CLEAR con=SQLCONNECT("LocalServer") IF con<1 ?"Failed to connect!!!" AERROR(aerrs) DISPLAY MEMORY LIKE aerrs RETURN ENDIF IF 1!=SQLEXEC(con,[create table uptable(id int, "desc" int)]) ?"Failed to create table!!!" AERROR(aerrs) DISPLAY MEMORY LIKE aerrs RETURN ENDIF LOCAL oCA as CursorAdapter oCA=CREATEOBJECT("CAPrintInsCommand") oCA.Alias="CATest" oCA.DataSourceType="ODBC" oCA.DataSource=con oCA.SelectCmd="select * from uptable" IF !oCA.CursorFill() ?"CursorFill failed!!!" AERROR(aerrs) DISPLAY MEMORY LIKE aerrs ELSE oCA.Tables=["uptable"] oCA.KeyFieldList="id" oCA.UpdatableFieldList = "id, desc" oCA.UpdateNameList=[id "uptable"."id",desc "uptable"."desc"] INSERT INTO CATest VALUES (1,1) IF !TABLEUPDATE(.F.) ?"TABLEUPDATE failed!!!" AERROR(aerrs) DISPLAY MEMORY LIKE aerrs ENDIF oCA.Tables=[uptable] oCA.KeyFieldList="id" oCA.UpdatableFieldList = "id, desc" oCA.UpdateNameList=[id uptable.id,desc uptable."desc"] INSERT INTO CATest VALUES (2,2) IF !TABLEUPDATE(.F.) ?"TABLEUPDATE failed!!!" AERROR(aerrs) DISPLAY MEMORY LIKE aerrs ENDIF TABLEREVERT(.T.) ENDIF CLOSE TABLES SQLEXEC(con,[select * from uptable],"CurrentState") SELECT CurrentState LIST SQLEXEC(con,[drop table uptable]) SQLDISCONNECT(con) return DEFINE CLASS CAPrintInsCommand AS CursorAdapter PROCEDURE BeforeInsert LPARAMETERS cFldState, lForce, cInsertCmd ? ? PROGRAM() ? "cInsertCmd=",cInsertCmd ? ENDPROC ENDDEFINEHere is the output (the code prints Insert commands executed by the CursorAdapter):
CAPRINTINSCOMMAND.BEFOREINSERT cInsertCmd= INSERT INTO "uptable" ("id","desc") VALUES (?catest.id,?catest.desc) CAPRINTINSCOMMAND.BEFOREINSERT cInsertCmd= INSERT INTO uptable (id,"desc") VALUES (?catest.id,?catest.desc) Record# ID DESC 1 1 1 2 2 2Try to accommodate this code for your connection and table. If it still doesn't work, please post all the code as well as the output.
>>UpdatableFieldList = "id, desc" >>>>
>>>>><remote table name>, <remote field name>, >>>>>>>>>>
>>>>><remote table name>.<remote field name>, >>>>>>>>>>