wood burning stoves
The moose likes JSP and the fly likes 'Syntax Error in Query operator' MS Access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark " Watch " New topic

'Syntax Error in Query operator' MS Access

pucmann pucmann

Joined: Apr 28, 2003
Posts: 1
I have been trying to get a solution to this problem for a while and I think i am getting close.
Basically, I'm trying to delete a record from my MS Access database where the 'Err-Date'(date/time field in format (mm/dd/yyyy)) field matches the date entered into a form by the user. Actually, my main objective is to delete all records that fall within two dates enetred by the user, but for know i'm just trying to get this to work. I beleive I am using the correct String to Date conversion syntax but i am recieveing the following error:
Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Err_Date = Sat Dec 12 00:00:00 PST 1998'.
The date should not be in the above format 'Sat Dec 12 00:00:00 PST 1998'.
Here is my code:
<%@page import="java.sql.*"%>
<%@ page import="java.text.SimpleDateFormat"%>
<%@ page import="java.util.Date"%>
//define connection
Connection con = null;
//get the class
//get the connection
con = DriverManager.getConnection"jdbc dbc:errorlog", "admin", "");
//please catch your exceptions!
catch(Exception e){
//define resultset and statement
ResultSet rs=null;
Statement stmt=null;
try {
//Using the current database connection create a statement
String start = request.getParameter("From");//TAKEN FROM FORM
String end = request.getParameter("To");//TAKEN FROM FORM
SimpleDateFormat dateFormat = new SimpleDateFormat ("MM/dd/yyyy");
Date date = dateFormat.parse(end);
String sql="DELETE FROM tblError WHERE Err_Date = "+date+"";
rs = stmt.executeQuery(sql);
//close all your open resultsets, statements, and connections
//catch all your exceptions
catch (SQLException e) {
I agree. Here's the link: http://aspose.com/file-tools
subject: 'Syntax Error in Query operator' MS Access
It's not a secret anymore!