try
{
String ptype = null;
if(b1.isSelected())
{
ptype="cash";
}
else if(b2.isSelected())
{
ptype="cred";
}
String rID=ridt.getText();
String cID=cidt.getText();
double Rcharge=Double.parseDouble(rct.getText());
double Mcharge=Double.parseDouble(mct.getText());
double total=Double.parseDouble(tott.getText());
double sum=Double.parseDouble(casht.getText());
double change=Double.parseDouble(balt.getText());
String sql0 ="INSERT INTO transactions(transaction_id,reservation_id,cus_id,room_charges,meal_charges,total_amount,cash,change,payment_type,emp_id)values('"+?+"','"+rID+"','"+cID+"','"+Rcharge+"','"+Mcharge+"','"+total+"','"+sum+"','"+change+"','"+ ptype+"','e010')";
pst=conn.prepareStatement(sql0);
pst.execute();
}
catch(NumberFormatException | SQLException e)
{
System.out.println(e);
}
In the above sql statement transaction_id is an auto increment field. How do I insert that value to the table? If I left that value in the code will it be added to the table at the database?