Skip to main content
Known Participant
October 30, 2009
Answered

Access Query

  • October 30, 2009
  • 1 reply
  • 693 views

I'm trying to run this query in coldfusion to retrieve data from Access:

<cfquery datasource="Master" name="TestQRY">
  SELECT Employee_Name
  FROM tbl_Benefits
  WHERE (((tbl_Benefits.Employee_ID)="2328"));
  </cfquery>
  <cfdump var="#TestQRY#">

If I run it without the WHERE clause it is no issue... But with Where Clause I get the following errors...

Error Executing Database Query.

[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
The error occurred in D:\inetpub\wwwroot-dev\y_b_g\App.cfm: line 1
1 : <cfquery datasource="Master" name="TestQRY">
2 :           SELECT  Employee_Name
3 :           FROM tbl_Benefits 

    This topic has been closed for replies.
    Correct answer Adam Cameron.

    OK.  Is the ID a character data type?  It doesn't look like it (and probably shoudln't be if it is).  If it's a numeric: lose the quotes.  And SQL uses single quotes for string delimiting, not doubles.  Although I think Access lets you get away with double quotes.

    Also, the semi-colon - sorry, didn't notice it before - is probably what's causing the error.

    Is this code for a production application?  If so, you should not use Access if at all possible.  It's a desktop solution, and websites are not desktop applications.  Access is not designed for this sort of usage.

    --

    Adam

    1 reply

    Inspiring
    October 30, 2009

    What's with all the parentheses in the WHERE statement?

    --

    Adam

    RosieGpAuthor
    Known Participant
    October 30, 2009

    well got rid of parentheses but still doesn't work...

    ilssac
    Inspiring
    October 30, 2009

    IS your Employee_Id field really a text or character data type?  Or is it a number type which means you would not put the values into "".

    Also, some databases do not like double quotes, prefering to use singe quotes, if that field really is a text|character data type.

    TO Adam:  All those parentesies are what you get if you use Access's query builder feature.