Link to home
Start Free TrialLog in
Avatar of ozzyfanta
ozzyfanta

asked on

combine insert and update sql statement in JSP

I would like to insert data in a table a table called Reservations and Update the Books table to change the reserved row from "N" to "Y". It is a website that let the user reserve a book...if the book is reserved, the username is inserted in the reservations table and the status of the books will change to (REserved=='Y')...

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("Jdbc:Odbc:dBase","","");
stmt=con.createStatement( );

stmt.executeUpdate("INSERT INTO Reservations(ISBN,ReservedDate)"
+ "VALUES('"+isbn_n+"','"+date_d+"')" AND "UPDATE Books SET Reserved='Y' WHERE BookTitle='"+Book_Title+"'");


out.println("You have reserved the book successfully");


}

Open in new window


it is seems like the way i combine the two is wrong...could you pls help with to discover the mistake...

Thanks folks
ASKER CERTIFIED SOLUTION
Avatar of cmalakar
cmalakar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial