i'm trying to pass a sql update to update the record based on a variable here is what i have so far
cust being my variable that hold the key value to update
Code:
'Get 'Value' property of 'Custid' in Form 'TST2' . DIM SHARED CUST AS c CUST = parentform:Custid.value 'Update a record(s) in a remote SQL database. 'DIM a connection variable DIM cn as SQL::Connection dim flagResult as l flagResult = cn.open("::Name::******.net") if flagResult = .f. then ui_msg_box("Error","Could not connect to database. Error reported was: " + crlf() + cn.CallResult.text) end end if 'Specify that we are using Portable SQL syntax cn.PortableSQLEnabled = .t. 'Dim a SQL arguments object, create arguments and set their values DIM args as sql::arguments if a5_eval_valid_expression("=Var->user",local_variables()) then args.add("New__called",convert_type(a5_eval_expression("=Var->user",local_variables()),"C")) end If dim sqlUpdateStatement as c sqlUpdateStatement = [COLOR="Red"]<<%txt% UPDATE custinfo SET called = :New__called WHERE custid = 'cust' %txt%[/COLOR] dim flag as l flag = cn.Execute(sqlUpdateStatement,args) if flag = .f. then ui_msg_box("Error","Record was not updated. Error reported was: " + crlf(2) + cn.CallResult.text,UI_STOP_SYMBOL) else if cn.AffectedRows() > 0 then ui_msg_box("Notice", "" + cn.AffectedRows() + " record(s) updated.",UI_INFORMATION_SYMBOL) else ui_msg_box("Error","Record was not updated." ,UI_STOP_SYMBOL) end if end if 'Now, close the connection cn.close()
Comment