here java code:
borrowbook issue = new borrowbook(integer.parseint(txtuserid.gettext()), integer.parseint(txtbookid.gettext()), ((jtextcomponent)dateborrow.getdateeditor().getuicomponent()).gettext(), ((jtextcomponent)datereturn.getdateeditor().getuicomponent()).gettext()); statement stmt = conn.createstatement(); string sql= "select* guest guestid= " +issue.getguestid()+ ""; rs=stmt.executequery(sql); if(rs.next()){ // statement stmt = conn.createstatement(); string sql = "insert bookissue (guestid,bookid,borrowdate,returndate) values("+issue.getguestid()+ ","+issue.getbookid()+",'" +issue.getborrowdate()+ "','"+issue.getreturndate()+"')"; stmt.executeupdate(sql); stmt.executeupdate(sql2); joptionpane.showmessagedialog(null, "book borrowed successfully"); }else{ joptionpane.showmessagedialog(null, "id not found","error",joptionpane.error_message); } my class:
public class borrowbook extends issuebook { public borrowbook(int guestid, int bookid, string borrowdate, string returndate) { super(guestid,bookid, borrowdate, returndate); }
Comments
Post a Comment