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!

Passing URL.Parameter and using in CFQuery

Status
Not open for further replies.

JodyMarie

Programmer
Feb 8, 2002
2
US
Please Help,

I know this is a simple question but for some reason I can not get it to work. I am passing a parameter through the URL and then I would like to run a query off of that parameter, but I can not get it to work. I have tried the Where statement many different ways.

Here is my code:

<cfquery datasource=&quot;printer&quot; name=&quot;aboutPrinters&quot;>
Select * From Printer
Where PrinterID = #URL.PrinterID#
</cfquery>

Here is my error:

ODBC Error Code = 07001 (Wrong number of parameters)


[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

Hint: The cause of this error is usually that your query contains a reference to a field which does not exist. You should verify that the fields included in your query exist and that you have specified their names correctly.



Any help would be great.

Thanks,

JodyMarie

 
Looks like printerid is not a field.

try
<cfquery datasource=&quot;printer&quot; name=&quot;aboutPrinters&quot;>
Select * From Printer
</cfquery>

<cfoutput>#aboutPrinters.columnlist#</cfoutput>

maybe PrinterID is Printer_ID?

webron
 
webron,

Thanks for the response! I got it figured out, I forgot single quotes.

JodyMarie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top