PDA

View Full Version : how to insert a record into two different databases but same group?


NinjaTurtle
09-02-2002, 12:06 PM
dear,

how to insert a record into two different databases but same in the same group?

example, i have two databases(inside have many tables), one of the database called "Register" another 1 called "User".

i want to generate a Register number from "Register" Database's table (Register_Code table), then after i get the Register number, i will add into "User" Database as Primary key then add all the user's info to User database's table(called USer _Info) then after finished add the user info i will get back to "Register" table to add a value there!! is quit complicated rite? but its like that... pls help me up...

raf
09-03-2002, 09:21 AM
i'm not sure i understood your problem completely.

i think it comes down to : i want to insert a record in a table and retrieve an identifiër (primary key) for the inserted record. i then wan't to insert this identifiër and some other stuf into another database. finally i want to update the record in the first database.

so the only tricky part is : get the identifiër from the newly inserted record.

the best way to do this depends on the databas-format.What kind of database do you use ?

You might also want to check out this thread
http://www.codingforums.com/showthread.php?s=&threadid=3768&highlight=%40%40identity