private void SubmitActionPerformed(java.awt.event.ActionEvent evt) {
try
{
Statement s = con.createStatement();
Statement s1 = con.createStatement();
Statement s2 = con.createStatement();
Statement s3 = con.createStatement();
ResultSet rs = s.executeQuery("select MAX(Guest_ID) from Guests");
rs.next();
int maxGuestID = rs.getInt(1) + 1;
//s1.execute("insert into Guests values(" + maxGuestID + ",'" + txtUserName.getText() + "',' " + txtUserAddress.getText() + "','"+ txtUserPhone.getText() + "','"+ txtUserEmail.getText() + "','" + cmbCreditCardType.getSelectedItem() + "','"+ txtCreditCardNumber.getText() + "')");
// insert data into reservation table
ResultSet rs1 = s2.executeQuery("select MAX(Reservation_ID) from Reservation");
rs1.next();
int maxResID = rs1.getInt(1) + 1;
//i'm getting error for date
s3.execute("insert into Reservation values(" + maxResID + "," + maxGuestID +",'"+ChkPrepaid.getSelectedObjects()+",'"+txtCheckInDate.getText()+"','"+txtCheckOutDate.getText()+ "'");
}
catch(Exception e)
{
System.out.println("Error: " + e);
}
bandibas 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.