A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
how to insert foreign key into JSP through servlet
Joined: Oct 27, 2011
Oct 27, 2011 04:50:56
+ Mysql +
PreparedStatement psw = (PreparedStatement) connection.prepareStatement("insert into city values(?,?,?)"); psw.setInt(1,0); psw.setString(2,city); PreparedStatement pst = (PreparedStatement) connection.prepareStatement("insert into district values(?,?,?)"); pst.setInt(1,0); pst.setString(2,district);
how insert foreign key (idCity) into district?
author & internet detective
Joined: May 26, 2003
Oct 28, 2011 14:47:02
Welcome to CodeRanch!
You can write some code to return the primary key for cities created by the database. Here is an
. Then it is easy stmt.setString(3, returnedValue);
How To Ask Questions The Smart Way
Blogging on Certs:
SCEA Part 1
Part 2 & 3
Core Spring 3
TOGAF part 1
subject: how to insert foreign key into JSP through servlet
dynamically inter relate two drop down list in jsp
image and form data upload problem
Inserting a 'weird' sentence into database
Using strings within strings to read vars?
Database helper class and closing question
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014