
19 Jan
2011
19 Jan
'11
3:20 p.m.
Hello James, Using stored procedures might be your best shot at getting the most accurate results. You can possibly combine this with the use of database transactions. 1) The procedure for Inserting to the first table should have the id / key of the inserted record as its return value to the C++ program. E.g; -- This is more of a MySQL query. I have omitted the specific syntax of creating stored procedures ( DELIMITER // .... CREATE OR REPLACE PROCEDURE ....... AS ...... BEGIN ); INSERT INTO table_one values ( x, y, z); RETURN last_insert_id ; 2) The calling program should use the value returned, say an integer and use it to do the next Insert, maybe by calling another procedure and using the value returned as a parameter. Martin.