This topic is locked

After Record Updated

4/5/2009 9:25:11 AM
ASPRunnerPro General questions
T
telemark author

I am trying insert a record into anther table after a record has been updated from the edit page. First I tried

[codebox]strSQLSave = "INSERT INTO tbllog (UFaultID, PriorityID, DeptID, ActionStatus, ActionUname, StatusID, EndDate, CommentID) SELECT UFaultID, PriorityID, DeptID, ActionStatus, ActionUname, StatusID, EndDate, CommentID FROM " & strTableName & " where " & where

'dbConnection.Execute strSQLSave[/codebox]
So I tried the
[codebox]dal.TableName.Field1=Value1

dal.TableName.Field2=Value2

dal.TableName.Add()[/codebox]
I changed the Tablename for the table I'm copying too, and changed the field names according to each different field. wasn't sure about the Value fields though. Is there anything else I need to do
Thanks
Andy

Sergey Kornilov admin 4/5/2009

Both methods will work.
To troubleshoot the first method print SQL query on the web page and test it against your database.
In second method you need to use some real values instead of Value1 and Value2.
If you use AfterEdit event try something like this:
dal.TableName. ActionStatus=dict("ActionStatus")

dal.TableName. ActionUname=dict("ActionUname")

dal.TableName.Add()

T
telemark author 4/6/2009

Thanks, the second method worked fine. Great response answering on a Sunday.
Andy