ANGWK
asked on
SQL in VB ...
if i have 2 tables , tabel1 and table2 , how can i insert the value into table1-ID and table2-CustomerID ?
*ID is the field in table1 and CustomerID in table2 ?
-------------------------- ---------- ---------- ---------- ---------- ---------- -------
sSQL1 = "insert into account_table(ACC_TYPE )values ('" & lblAccType & "') where account_table.CUST_ID = customerinfo_table.ID"
Set rs = conn.Execute(sSQL1)
is there anything wrong with above code ?
I'm running mySQL in VB :)
THanks . Marks will be awarded base on First Come First Serve Basis.
*ID is the field in table1 and CustomerID in table2 ?
--------------------------
sSQL1 = "insert into account_table(ACC_TYPE )values ('" & lblAccType & "') where account_table.CUST_ID = customerinfo_table.ID"
Set rs = conn.Execute(sSQL1)
is there anything wrong with above code ?
I'm running mySQL in VB :)
THanks . Marks will be awarded base on First Come First Serve Basis.
ASKER
rdrunner , how bout if i wan to enter a value into 2 different tables , different fields ?>
ASKER
rdrunner , how bout if i wan to enter a value into 2 different tables , different fields ?>
Then use 2 insert statements (can be in one string seperated by go), or use a trigger or a stored procedure...
And your SQL also only tries to insert one row into one table...
And your SQL also only tries to insert one row into one table...
ASKER
rdrunner , how bout if i wan to enter a value into 2 different tables , different fields ?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You dont know which ID you are talking about. If you want to update existing data you should use an update script...
If you want to insert new data you should pass the ID along and insert both values (type & ID)