M
|
markynewport author 7/6/2016 |
Hi there, I am trying to add data to another table in asp.net in ther before record updated on the edit page, I used to do this in asprunner pro with the following code. '** Insert a record into another table **** if values("field1")<> "field1value" then Response.Write "No visit entered" else set dal_table=dal.Table("table2") dal_table.visitID=values("ID") dal_table.updatedvalue=values("updatedby") dal_table.dateupdated=values("dateupdated") dal_table.Add() end if I have tried the below code but no joy. dynamic tbltable1 = GlobalVars.dal.Table("table1"); tbltable1_history.Value["VisitID"] = values("ID"); tbltable1_history.Value["visited_by"] = values("updatedby"); tbltable1_history.Value["visitdate"] = values("dateupdated"); tbltable1_history.Add(); Any help greatly appreciated. Regards, Mark.
|
![]() |
jadachDevClub member 7/6/2016 |
How about this - after record updated? |
M
|
markynewport author 7/8/2016 |
How about this - after record updated? dynamic tbltable1 = GlobalVars.dal.Table("table1"); tbltable1.Value["VisitID"] = values["ID"]; tbltable1.Value["visited_by"] = values["updatedby"]; tbltable1.Value["visitdate"] = values["dateupdated"]; tbltable1.Add();
|
![]() |
Sergey Kornilov admin 7/8/2016 |
This is correct, if you use an autonumber/autoincrement column its value doesn't yet exist in BeforeAdd event. In this case you need to use AfterAdd event and keys["KeyColumnName"] instead of values["KeyColumnName"] |
M
|
markynewport author 7/13/2016 |
Hi Jerry, |
![]() |
jadachDevClub member 7/13/2016 |
You can do it on the edit page. Make your fields read only if you don't want the users making changes. Then in Before record updated, use values["referral_reviewed"] = "Yes"; |
M
|
markynewport author 8/5/2016 |
I forgot to add back in the conditional statement at the start of |
M
|
markynewport author 8/5/2016 |
I forgot to add back in the conditional statement at the start of |
![]() |
jadachDevClub member 8/5/2016 |
Try something like this: |