This topic is locked
[SOLVED]

 Inserting Data two tables

2/21/2011 2:01:20 AM
ASPRunnerPro General questions
A
adnankmk author

I am using ASP Verion 6.2
I have two talbes.
Table1

TM_ID Amount Year
Table2

B_ID Opening Closing TM_ID
TM_ID is primary key and foreign key linked with inner join.
I have add custom views on Table1 and also add the filed of table2 on custome view. But When i add values it gives an error. Can any one reslove this issue.

Sergey Kornilov admin 2/21/2011
A
adnankmk author 2/21/2011



Here is an example that can help:

http://xlinesoft.com/asprunnerpro/docs/update_multiple_tables.htm


sql = "update Table2 set TM_ID=" & values("TM_ID") & " ... "
dbConnection.Execute sql
values.Remove("TM_ID")
I have used this query but not able to insert in the other table. I need help to join two tables.

Sergey Kornilov admin 2/22/2011

I'm not sure how join is relevant here.
Your examples updates data. If you need to add a new record use INSERT query i.e.

sql = "INSERT into Table2 (TM_ID) values (" & values("TM_ID") & ")"
A
adnankmk author 2/23/2011



I'm not sure how join is relevant here.
Your examples updates data. If you need to add a new record use INSERT query i.e.

sql = "INSERT into Table2 (TM_ID) values (" & values("TM_ID") & ")"



Thanks very much for responding the query. I have used this query in the table. but the values are added in the table1 but not added in the table2.
sql = "INSERT into Table2 (TM_ID) values (" & values("TM_ID") & ")"
I want to confirm (TM_ID) is the field name of the table2. becase same field name exist in table1 as primary key.