Dan
Dan

Reputation: 3367

(ColdFusion + Access) Database Query Error "Too few parameters."

I'm about to rip my hair out with this one.

Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 3.

The error occurred in [WITHHELD]: line 19

17 :                 WHERE      FNAME = #FORM.first#
18 :                 AND            LNAME = #FORM.last#
19 :                 AND            PASS = #FORM.pass#
20 :             </cfquery>
21 :         

SQLSTATE      07002
SQL        SELECT * FROM JUDGES WHERE FNAME = [WITHHELD] AND LNAME = [WITHHELD] AND PASS = [WITHHELD]
VENDORERRORCODE       -3010
DATASOURCE    honors

I've read a number of similar issues where there was some spelling error but I've checked and rechecked spellings, even changed column and table names and tried again.

Upvotes: 2

Views: 1299

Answers (1)

Antony
Antony

Reputation: 3781

Ensure that you quote your variables:

where FNAME = '#FORM.first#'

Additionally, you should really use cfqueryparam to protect against SQL injection attacks:

where FNAME = <cfqueryparam value="#FORM.first#" cfsqltype="CF_SQL_VARCHAR">

(Note that you do not need the quotes when using cfqueryparam)

Upvotes: 6

Related Questions