This topic is locked

AfterEdit Event

2/6/2007 7:54:03 PM
ASPRunnerPro General questions
Z
zion4ever author

Hello,
I have a schema called TS. This db hols several tables. Two of them are linked by master-detail in Asprunner. These tables are: ts_client_name and members. In the CHANGE PASSWORD event I can correctly change the password field of table MEMBERS and it is inserted properly in the corresponding password field of table TS_CLIENT_NAME. However I would like to do the same when a user EDITS the db. The correct corresponding record is found by the code, but it is updated with nullstrings. So it knows which record to update. This leads me to conclude that the used variabeles are null.
In the AFTER_RECORD_UPDATED event of asprunner pro 4.1 (latest build) i have the following code:
Sub AfterEdit()

'** Custom code ****

' put your custom code here
'Update TS status ****
Dim Nickname

Dim Password
Nickname = GetRequestForm("Nickname")

Password = GetRequestForm("Password")

CurUser = Session("UserID")
strSQLUpdate = "UPDATE ts.ts2_clients SET `s_client_name` = '" & Nickname & "', `s_client_password` = '" & Password & "' WHERE `s_client_name` = '" & CurUser & "'"

dbConnection.Execute strSQLUpdate

End Sub
Why are no values assigned to the variabeles nickname and password? What I want to accomplish is that when a user edits the nickname and/or password it is also updated in the other table. I've tried form.request("Nickname"), GetRequestForm("Nickname"), I've even trie to put the code in the BeforeEdit event as dict("Nickname")=GetRequestForm("Nickname").
Please help me out
Hans

Holland

J
Jane 2/7/2007

Hans,
use Before record updated event for your purpose.

Here is a sample code:

Function BeforeEdit(dict, where)

CurUser = Session("UserID")
strSQLUpdate = "UPDATE ts.ts2_clients SET `s_client_name` = '" & dict("Nickname") & "', `s_client_password` = '" & dict("Password") & "' WHERE `s_client_name` = '" & CurUser & "'"

dbConnection.Execute strSQLUpdate
BeforeEdit = True

End Function

Z
zion4ever author 2/7/2007

Thank you Jane, it work now!