
Hi, heres my code
private void bookedButton() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection conn = DriverManager.getConnection("jdbc:odbc:BUS","","");
Statement stmt= conn.createStatement();
// stmt.execute("Set identity_insert customers on");
String current_status="BOOKED";
emp =conn.prepareStatement("INSERT INTO customers (cust_name,cust_nic,cust_contact,cust_address,seat_no,departure_date,amount,total_amount,advance,remaining_amount,booking_date,checkin_date,current_status) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,'"+ current_status+"')");
emp.setString(1, text1.getText());
emp.setString(2, text2.getText());
emp.setString(3, text4.getText());
emp.setString(4, text3.getText());
emp.setString(5, rtext2.getText());
emp.setString(6, ctext2.getText());
emp.setString(7, rtext3.getText());
emp.setString(8, rtext4.getText());
emp.setString(9, rtext5.getText());
emp.setString(10, rtext6.getText());
emp.setString(11, ctext1.getText());
emp.setString(12, ctext3.getText());
emp.executeUpdate();
// JOptionPane.showMessageDialog( this, "BOOKING SUCCESSFUL!","BOOKING RESULT", JOptionPane.PLAIN_MESSAGE );
// dispose();
}
catch(Exception e)
{
JOptionPane.showMessageDialog( this, "BOOKING UNSUCCESSFUL!\n\nAll Fields Mandatory\n\nCheck Either Seat is Available or Not","Error", JOptionPane.ERROR_MESSAGE );
System.out.println(e.getMessage());
}
}
Im making a ticket reservation system with sql server connectivity at the background to save the data. Now, after entering the data in the fields, i get two "General Eroor". I don't know if i made the connectivity wrong. Kindly help me resolve this issue ASAP. Thank you.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.