I have created a GUI based Hotel Management System in java netbeans which is connected with Ms Access Database. In database, i have a table named "RoomInfo".
When i try to execute the following query, i get two kinds of errors.
String sql = "INSERT INTO RoomInfo(RoomNumber,Reserved,RoomCategory,AirConditioned,
BedType, RentPerDay)VALUES("+objr.roomno+","+objr.reserved+","+objr.category+","
+objr.AirConditioned+","+objr.bedtype+","+objr.rent+")";
First error is net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::3.0.7 unexpected token: , I get this error when i leave all the Jtextfields empty and try to insert new record in to the database.
Second Error is net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::3.0.7 user lacks privilege or object not found: Economy (Economy is the entry for room category) I get this error when i enter data in to the Jtextfields and try to save it in to the database.
Need help identifying the problem.
?) as parameter placeholders in your SQL command text, e.g.,... VALUES (?,?,?,?,?,?). (2) You are doing your "None of the fields can be left empty" check after trying to insert the row, instead of before.