I'm having a problem.
I have a table called issuebook in my MYsql database where there are 5 columns.
The columns are: memberid, membername, bookname, issuedate, returndate.
So I only want to insert data in 3 columns in memberid, membername, bookname and leave the other 2 columns blank for now (because in those columns when admin gives date then data will be inserted in those columns).
But whenever I try to insert it, it shows me an error like this:
java.sql.SQLException: Field 'issuedate' doesn't have a default value
My code is given below:
String bname,name,id;
id = Start.ID1;
name = Start.NAME1;
bname = bookBox.getSelectedItem().toString();
try {
pst = con.prepareStatement("insert into issuebook(memberid,membername,bookname)values(?,?,?)");
pst.setInt(1, Integer.parseInt(id));
pst.setString(2, name);
pst.setString(3, bname);
pst.executeUpdate();
JOptionPane.showMessageDialog(null, "Your Request is sent.");
}
catch (SQLException e1) {
e1.printStackTrace();
}
My database table :