Please enable JavaScript to view this site.

Navigation: Advanced topics > Events > Sample events > Database

Update multiple tables

Scroll Prev Next More

 

To update two joined tables, use the following code in the Add page: Before record added and/or Edit page: Before record updated events.

 

 

 

dim sql
sql = "update othertable set joinedfield=" & values("joinedfield") & " ... "
CustomQuery sql
values.Remove("joinedfield")

 

To update master and details tables:

 

1. Use the following code for the joined table in the Add page: Before record added and/or Edit page: Before record updated events.

 

dal.Table("othertable").Param("fieldname")=values("fieldname")
dal.Table("othertable").Value("joinedfield")=values("joinedfield")
dal.Table("othertable").Update()
values.Remove("joinedfield")

 

2. Use the following code for the details table in the Add Page: After record added and/or Edit page: After record updated events.

 

dal.Table("detailstable").Param("detaillinks")=oldvalues("detaillinks")
dal.Table("detailstable").Value("detailfield")=values("detailfield")
dal.Table("detailstable").Update()
values.Remove("detailfield")

See also:

Data Access Layer

Database API

Database API: DB::Exec

Master-details relationship between tables

Update multiple records on the List page