Hi, String sql = "update rooms set status = '"+strStatus+"' where room_number="+roomnum;
And since this query does not return u a resultset, u could use, int numOfRowsUpdated = stmt.executeUpdate(); Hope this helps. Priya. -----Original Message----- From: panos periorellis [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 17, 2002 4:36 PM To: [EMAIL PROTECTED] Subject: DATABASE UPDATE I"m trying to do a simple table update but I cant get the syntax right. The book I have JSP in 24 hours isnt that good. only has a bad example... Anyway All i want to do i update a field of a record which has a number equeal to a variable Can someone update the following code and send it to me? I know that the syntax of the SQK is wrong.. The table is called Rooms and the Field status...but i ony want to update the staus of the record of a partiular number (roomnum) I would appreciate a response... Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );Connection con = DriverManager.getConnection("jdbc:odbc:Bluerooms"); Statement stmt= con.createStatement(); String sql = "INSERT INTO Rooms Status VALUES 'Closed' WHERE Room_number="+roomnum ; // this is the dodgy stament stmt.executeQuery(sql); con.close( ); "THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE ADDRESSEE and may contain confidential and privileged information. If the reader of this message is not the intended recipient, you are notified that any dissemination, distribution or copy of this communication is strictly Prohibited. If you have received this message by error, please notify us immediately, return the original mail to the sender and delete the message from your system." =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
