lcSql = "UPDATE myTable SET myField = ?myValue WHERE pk = ?mypk" IF oDataClass.prepare(tnConnection,lcSql) ** tnConnection is a valid, pre-existing connection to an ODBC datasource SCAN mypk = table.pk myvalue = table.value IF NOT oDataClass.sql_execute(tnConnection) ** this is the line that was wrong in the example. ** You don't pass the SQL when executing a prepared statement ** Error Handling Code ENDIF ENDSCAN ELSE ** Error Handling Code ENDIF ***oDataClass.prepare LPARAMETERS tnConnection,tcSql =SQLPREPARE(tnConnection,tcSql) ** With appropriate error handling"Is parameter tcSql supposed to be lcSql?"
>>>* Your code: >>>IF EMPTY(tcSql) && Processing via an SQLPREPARE() statement >>> tcSql = " " && So Error Routine has character value >>> lnResult = SQLEXEC(tnConnection) && ????? >>>>>>
>>lcSql = "UPDATE myTable SET myField = ?myValue WHERE pk = ?mypk" >>IF oDataClass.prepare(tnConnection,lcSql) >> SCAN >> mypk = table.pk >> myvalue = table.value >> IF NOT oDataClass.sql_execute(tnConnection,lcSql) >> ** Error Handling Code >> ENDIF >> ENDSCAN >>ELSE >> ** Error Handling Code >>ENDIF >> >>***oDataClass.prepare >>LPARAMETERS tnConnection,tcSql >>=SQLPREPARE(tnConnection,tcSql) >>** With appropriate error handling >>>