Try this for the SQL string:

String sql = "UPDATE Rooms SET Status='Closed' WHERE
Room_number="+roomnum;

David

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]] On Behalf Of panos periorellis
Sent: Thursday, January 17, 2002 3:06 AM
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( );

===========================================================================
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

Reply via email to