This topic is locked
[SOLVED]

 Update Field Value In Other Table

5/28/2013 6:49:08 AM
ASPRunnerPro General questions
A
adnankmk author

I have two tables with the following details
table 1: Employees:
id (int)

name (varchar)

post_id (varchar)
Table 2: Posts
post_id (int)

Post_name (varchar)

Status (int)
I want on update the Employees table the Status field should be set "1" by changing the "post_id" field of same post_id in the Posts table.
What code should I use this in the events for updating the field. I used this code beforeedit event.
sql="UPDATE Posts SET Status='1' WHERE [b]Post_id= '"values("id")"'"

rs=CustomQuery(sql)

[/b]
It gives me code error
thanks in advance

A
adnankmk author 5/29/2013

I have solved the problem by writing this code
sql="UPDATE Posts SET Status='1' WHERE Post_st_id= '" & values("id") & "'"

rs=CustomQuery(sql)



I have two tables with the following details
table 1: Employees:
id (int)

name (varchar)

post_id (varchar)
Table 2: Posts
post_id (int)

Post_name (varchar)

Status (int)
I want on update the Employees table the Status field should be set "1" by changing the "post_id" field of same post_id in the Posts table.
What code should I use this in the events for updating the field. I used this code beforeedit event.
sql="UPDATE Posts SET Status='1' WHERE [b]Post_id= '"values("id")"'"

rs=CustomQuery(sql)

[/b]
It gives me code error
thanks in advance