Answer to Question #58073 in Java | JSP | JSF for Lina

Question #58073
The insert statement is working fine for one table but when I try to insert into two it gives an error. Could you see the code below and give me any feedback?

public void insertContact() throws SQLException {

System.out.println("Please enter your ID");
String id = input.next();
System.out.println("Please enter your phone number");
String number = input.next();

try (Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE)) {

ResultSet rs = stmt.executeQuery("SELECT * FROM Contact "
+ "LEFT OUTER JOIN ContactTelNo "
+ "ON Contact.ContactId = ContactTelNo.ContactId");

rs.moveToInsertRow();
rs.updateString(idTable, id);
rs.updateString(numberTable, number);
rs.insertRow();
}
}
0
Expert's answer

Answer in progress...

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS