Please help,
Am trying to use the query below to return data from a mysql database but when I try compiling am receiving the following errors:
com\time\timeclock.java:84: unclosed string literal
("SELECT clocknum,date0,time0,fname,lname,dept,status FROM time_
sheet WHERE dept = ? AND
^
com\time\timeclock.java:85: unclosed string literal
date0 >= ? and date0 <= ? ORDER BY fname", ResultSet.TYPE_SCROLL_SENSITIVE, Resu
ltSet.CONCUR_READ_ONLY);
########## Method with SQL Query ######################
public ResultSet getUsers(String mydept, String sdate, String edate) throws SQLException, Exception {
ResultSet rst= null;
try {
PreparedStatement queryTimesheet = con.prepareStatement
("SELECT clocknum,date0,time0,fname,lname,dept,status FROM time_sheet WHERE dept = ? AND
date0 >= ? and date0 <= ? ORDER BY fname", ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
queryTimesheet.setString(1, mydept);
queryTimesheet.setString(2, sdate);
queryTimesheet.setString(3, edate);
rst = queryTimesheet.executeQuery();
} catch (SQLException sqle) {
error = "SQLException: Could not execute query.";
throw new SQLException(error);
} catch (Exception e) {
error = "An exception has occured while retrieving data,";
throw new Exception(error);
}
return rst;
}
Am trying to use the query below to return data from a mysql database but when I try compiling am receiving the following errors:
com\time\timeclock.java:84: unclosed string literal
("SELECT clocknum,date0,time0,fname,lname,dept,status FROM time_
sheet WHERE dept = ? AND
^
com\time\timeclock.java:85: unclosed string literal
date0 >= ? and date0 <= ? ORDER BY fname", ResultSet.TYPE_SCROLL_SENSITIVE, Resu
ltSet.CONCUR_READ_ONLY);
########## Method with SQL Query ######################
public ResultSet getUsers(String mydept, String sdate, String edate) throws SQLException, Exception {
ResultSet rst= null;
try {
PreparedStatement queryTimesheet = con.prepareStatement
("SELECT clocknum,date0,time0,fname,lname,dept,status FROM time_sheet WHERE dept = ? AND
date0 >= ? and date0 <= ? ORDER BY fname", ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
queryTimesheet.setString(1, mydept);
queryTimesheet.setString(2, sdate);
queryTimesheet.setString(3, edate);
rst = queryTimesheet.executeQuery();
} catch (SQLException sqle) {
error = "SQLException: Could not execute query.";
throw new SQLException(error);
} catch (Exception e) {
error = "An exception has occured while retrieving data,";
throw new Exception(error);
}
return rst;
}