LPARAMETERS tcAlias IF EMPTY( tcAlias ) tcAlias = this.cfetchalias ENDIF LOCAL lnNumFields, lnX, lnSelect, lcField, lcMemVar LOCAL ARRAY laFields[1] lnSelect = SELECT() SELECT (tcAlias) lnNumFields = AFIELDS( laFields ) FOR lnX = 1 TO lnNumFields lcField = laFields[lnX, 1] lcMemVar = "m." + lcField * leave the pk alone IF ALLTRIM(UPPER(lcField)) == ALLTRIM(UPPER(this.cpkfield)) LOOP ENDIF IF NOT &lcField == &lcMemVar REPLACE &lcField WITH &lcMemVar ENDIF ENDFOR SELECT (lnSelect)The SQL update is called from this chunk of code
If CursorGetProp("Buffering")=5 lnRecno = Recno() lnGetNextModified = Getnextmodified( 0 ) Do While lnGetNextModified # 0 Go lnGetNextModified lcUpdateStatus = Getfldstate(-1) If Left( lcUpdateStatus, 1) = "2" * note the update stored procedure needs to be setup to accept "@delete_tablename = 1" parameter lcUpdateMessage = "exec " + lcDatabase + "." + This.db_schema + "." + lcPrefix + "_update_" + This.cTableName + " @" + This.cpkfield + ; "=" + Alltrim(Str(Evaluate(This.cpkfield))) + ", @update_user = '"+ lcUpdateUser + "', @update_program = '" + lcUpdateProgram + "', " ; + " @delete_" + This.cTableName + " = 1" + ; IIF( Type( This.laUpdateTables[lnY] + ".ssnum") # "U", ", @demoid=" + Alltrim(Str(Int(Val(Eval( This.laUpdateTables[lnY] + ".ssnum"))))), "") + ; IIF( This.AlwaysSendAcctid And Not Empty( tcAcctId ), ", @acctid='" + tcAcctId + "'", "") llOk = This.SQLExec( lcUpdateMessage ) If Not llOk llUpdatesOk = .F. Endif lcUpdateMessage = "" *And so forthThere's about another page and a half of code like this.