java - book return in library management -


I am doing a library management project, this is the return book of this module.

  & lt; Form name = "book_return" method = "post" action = "return.jsp" & gt; & Lt;% // String position 1 = Request.Gate parameter ("position1"); // string com = "1 = 1"; // Connection Connection Connection Con = lm.Database.getConnection (); Prepared place PS = null; Results set rs = null; String Mid = Request Jupiter ("Mid"); // Description st = con.createStatement (); // ResultSet rs = ps.executeQuery ("Choose from those issues where middle =?"); String query = "Choose from those problems where middle =?"; Ps = con.prepareStatement (query); Ps.setstring (1, middle); Rs = ps.executeQuery (); // ResultSet rs = st.executeQuery ("Choose from those problems where middle =" + middle); // System.out.println ("query ==" + query); // Place prepared ps = con.prepareStatement ("Choose from those issues where = =?"); If (! Rs.next ()) {//out.println("lt;h4> sorry! The record was not found! & Lt; / h4 & gt;); Out.println ("& lt; p / & gt; & Lt; a href = 'javascript: history.back ()' & gt; back  & lt; th & gt; Credit date & lt; / th & gt; & lt; th & gt; renewal date & lt; / th & Lt; th & gt; Student ID & lt; / th> & lt; th & gt; Student name & lt; / th & gt; & lt; th & gt; ok & lt; / th & Gt; & lt; TR & gt; & lt; td & gt; & lt;% = rs.getString ("isbn")%> & lt; / td> & lt; td & gt; Lt;% = rs.getString ("bdate")%> gt; & lt; / td & gt; & lt; td & gt; & lt;% rs.getString ("rdate")%> & gt; & lt; / Td> & lt; td & gt; & lt ;% = Rs.getString ("middle")%> gt <>  & lt; td & gt; & lt; input type = "submit" value = "return" class = "btn btn -prephonic "/> gt;  & lt; / tr & gt; & lt;% while (rsnext ()) {%> & lt; tr & gt; & lt; Td> & Lt;% = rs.getString ("isbn")%> & Lt; / Td> & Lt; Td> & Lt;% = rs.getString ("bdate")%> & Lt; / Td> & Lt; Td> & Lt;% rs.getString ("rdate")% & gt; & Lt; / Td> & Lt; Td> & Lt;% = rs.getString ("center")% & gt; & Lt; / Td> & Lt; Td> & Lt; Input type = "submit" value = "return" class = "btn btn-primary" /> gt; & Lt; Td> & Lt; / TR & gt; & Lt;%} rs.close (); Rs.close (); Con.close (); & Gt%; & Lt; / Table & gt; & Lt; / Form & gt;  

I have to save the point which book will come back and update such a situation ...

  Public Intern Returnbook () {Connection Key = Null; Prepared place PS = null; Try {con = database.getConnection (); Ps = con.prepareStatement ("ifnull (maximum bid), 0) + 1" from books ;; Results set rs = ps.executeQuery (); Rs.next (); Int bid = rs.getInt (1); Rs.close (); Ps = con.prepareStatement ("Enter Return values ​​(?,?,?,?,?,?)"); Ps.setString (1, ISBN); Ps.setString (2, bdate); Ps.setstring (3, rdate); Ps.setInt (4, middle); Ps.setString (5, name); Ps.setInt (6, right); Println ("query ===" + ps); Ps.executeUpdate (); // Remove row from issues ps = con.prepareStatement ("remove issues from isbn =?"); Ps.setString (1, ISBN); Println ("query ===" + ps); Ps.executeUpdate (); // Updated books ps = con.prepareStatement ("Update books set status = 'a' where isbn =?"); Ps.setString (1, ISBN); Println ("query ===" + ps); If (ps.executeUpdate () == 1) return bid; Other return -1; } Hold (exception pre) {System.out.println (ex.getMessage ()); Return -1; } Finally {Database.clean (Co, PS); }}  

But I get an error like this ..

  query === com.mysql.jdbc.ServerPreparedStatement [2] - in return values Insert (empty, zero, zero, 0, zero, 0) question === com.mysql.jdbc.ServerPreparedStatement [3] - Remove from issues where isbn = null question === com.mysql.jdbc.serverPreparedStatement [4 ] - Set the position of books = 'A' where isbn = null  


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -