Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Query - Too Few Parameters Error Expected 1 1

Status
Not open for further replies.

TheVMan

IS-IT--Management
Feb 19, 2001
110
US
I have the following query:
<CFQUERY datasource=&quot;Metadata&quot; name=&quot;ObjectList&quot;>
SELECT
objects.Class_Name,
objects.Object_Name,
objects.Object_Description
FROM
objects
WHERE
((objects.Class_Name) Like &quot;*Entity*&quot;)
</cfquery>

It works in Access just fine, just as you see here, but when I let cold fusion send it through ODBC, I get the following error:

Too Few Parameters. Expected 1. It then gives a hint that my query contains a reference to a field that doesn't exist. This only happens when I have the WHERE clause included in it. Can anyone offer any advice? Thanks in advance.

V
 
normally in SQL when you are trying to compare strings you will use:
'%Entity%'

With the '%' being the wildcard and not a '*'.

Try that, see how you go.
 
Thanks JdgDreads, but passing % signs to Access doesn't work for wildcard searches. I did try it just for grins though. * are used.

V
 
The plot thickens...the error went away, but my output is 0. The query doesn't return results through CF, but does when copied to Access it does. Oh well. Thanks for all your help.

V
 
Access 97.

ODBC.

Where do you find which MDAC?

Thanks.
V
 
You can find the latest MDAC (2.6) on MSDN. I'm using the same setup (97 and ODBC) and getting results from the '%searchterm%' wildcard query.

Also, just for grins, remove all the parentheses from the WHERE clause. The driver doesn't need 'em, but the Access query builder throws 'em in.

Good luck,

PH
 
Thanks Phil. The parentheses seems to have been the problem. Learned a valuable lesson on this one. Have a great day.

V
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top