Hi-
I hope someone can help me with a problem using the value in a UX textbox in an XBasic Function that fires when a button is pressed:
Here's the simple XBasic function I'm using:
function myFunction6 as c (e as p)
'myFunction = "javascript commands to be executed in the Browser."
Dim cn as sql::connection
Dim args as SQL::Arguments
Dim sqlCommand as c
debug(1)
args.set("IDNum2", val(e.datasubmitted.IDNum2))
flag = cn.open("::Name::TimeCard")
sqlCommand = "UPDATE tblPunchIn SET tblPunchIn.EntryDate = NOW, tblPunchIn.InOut = 7 WHERE (tblPunchIn.IDNum= :IDNum2)"
flag = cn.execute(sqlCommand)
cn.Close()
end function
This function simply updates 2 fields in a SQL table. "IDNum2" is a value in a textbox on the UX component (For my test, the value is "71"). If I remove ":IDNum2" in the sqlCommand and substitute the number "71", everything works great.
SO, I know that the problem is with how I'm using ":IDNum". In my "debug" the 71 is shown (no error) as a value in the "args.set" line (that value comes from the "IDNum2" = e.datasubmitted.IDNum2 command that I placed in the "afterDialogValidate" Server-side event. When I replace the "71" with :IDNum2, it doesn't fire (debug just tells me that "a value is missing"). NOTE: I only added the "val" to the args.set line to see if I needed to convert to a value... it didn't change anything.
I have never used this function before, so I'm sure I'm doing something wrong, but I can't figure out what it is. I'd appreciate it if anyone can look at that function and the ":IDNum2" reference and let me know what I'm doing wrong.
Thanks for your help.
Phil
I hope someone can help me with a problem using the value in a UX textbox in an XBasic Function that fires when a button is pressed:
Here's the simple XBasic function I'm using:
function myFunction6 as c (e as p)
'myFunction = "javascript commands to be executed in the Browser."
Dim cn as sql::connection
Dim args as SQL::Arguments
Dim sqlCommand as c
debug(1)
args.set("IDNum2", val(e.datasubmitted.IDNum2))
flag = cn.open("::Name::TimeCard")
sqlCommand = "UPDATE tblPunchIn SET tblPunchIn.EntryDate = NOW, tblPunchIn.InOut = 7 WHERE (tblPunchIn.IDNum= :IDNum2)"
flag = cn.execute(sqlCommand)
cn.Close()
end function
This function simply updates 2 fields in a SQL table. "IDNum2" is a value in a textbox on the UX component (For my test, the value is "71"). If I remove ":IDNum2" in the sqlCommand and substitute the number "71", everything works great.
SO, I know that the problem is with how I'm using ":IDNum". In my "debug" the 71 is shown (no error) as a value in the "args.set" line (that value comes from the "IDNum2" = e.datasubmitted.IDNum2 command that I placed in the "afterDialogValidate" Server-side event. When I replace the "71" with :IDNum2, it doesn't fire (debug just tells me that "a value is missing"). NOTE: I only added the "val" to the args.set line to see if I needed to convert to a value... it didn't change anything.
I have never used this function before, so I'm sure I'm doing something wrong, but I can't figure out what it is. I'd appreciate it if anyone can look at that function and the ":IDNum2" reference and let me know what I'm doing wrong.
Thanks for your help.
Phil
Comment