-
relate two tables
hi all I have two tables;
table student (
UserId int Not null auto_increment ,
UniversityN varchar(10) Not null,
AstComposition varchar(3) Null,
BstComposition varchar(3) default null,
......)
table ApplyStatus(
UserId int Not null ,
UniversityN varchar(10) Not null,
UserIp varchar(45) Not Null,
AccessTime varchar(45) Not Null,
PRIMARY KEY (UserId),
FOREIGN Key(UserId) REFERENCES student(UserId) on Delete
Cascade on update cascade)Type=InnoDB DEFAULT CHARSET=utf8;
I want to use setAutocommit( false) to update this two table on the same time, and I relize I make a mistake , how to get my userId on the second table
________
ACURA CL HISTORY
Last edited by sql; 03-06-2011 at 02:07 AM.
-
You updated the second table without userid?
-
Originally Posted by MAK
You updated the second table without userid?
No, I want to use the userId from the first table and insert it into second tale
I use getGenerateKeys() to solve this problem
________
Roll a joint
Last edited by sql; 03-06-2011 at 02:08 AM.
-
care to post the solution?
-
I'd Be Interested in This, As Well...
I'd Be Interested in This, As Well... If you could share the solution, others can benefit going forward.
Thanks.
Bill
-
I post my solution already , but is in jdbc, and I use mysql
________
California special mustang
Last edited by sql; 03-06-2011 at 02:09 AM.
-
Thanks for the Feedback ...
... and for sharing your approach. Feedback like this makes for a "complete solution" that will benefit others who face similar challenges and who are searching for options.
Again, thanks!
Bill
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|