Ask a Question related to Coldfusion - Getting Started, Design and Development.
-
Vampyr_Bytes #1
Trouble with url variable in query
Hi there,
I'm having trouble getting a database query that uses url variables to work.
The query is
<cfquery Name="Display" datasource="Products">
SELECT ProductType, ProductInfo, CategoryType, CategoryInfo, ItemName,
ItemInfo, Price, Weight
FROM tblProducttype, TblCategorytype, TblItems
WHERE TblProducttype.ProductCode = tblCategorytype.ProductCode
AND tblCategorytype.CategoryCode = tblItems.CategoryCode
AND tblCategorytype.ProductCode = <cfqueryparam value="#URL.cat#"
cfsqltype="cf_sql_integer">
AND tblCategorytype.CategoryCode = <cfqueryparam value="#URL.type#"
cfsqltype="cf_sql_varchar">
AND tblItems.Available = "True"
</cfquery>
The error I'm getting is
Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft
Access Driver] Too few parameters. Expected 3.
The error occurred in C:\CFusionMX\wwwroot\Mother Earth's Goodies\Main.cfm:
line 9
7 : AND tblCategorytype.CategoryCode = tblItems.CategoryCode
8 : AND tblCategorytype.ProductCode = <cfqueryparam value="#URL.cat#"
cfsqltype="cf_sql_integer">
9 : AND tblCategorytype.CategoryCode = <cfqueryparam value="#URL.type#"
cfsqltype="cf_sql_varchar" >
10 : AND tblItems.Available = "True"
11 : </cfquery>
Any help would be appreciated
Vampyr_Bytes Guest
-
PARSING A QUERY OF QUERY WITH A VARIABLE VALUE
On my first page the user selects a project. I am using the variable SelectedProject: <cfset SelectedProject =... -
query trouble
i'm just getting started here, and am having trouble building queries. after filling in the information tables, i press the 'ok' button, and this... -
Trouble with sql query
Hi, I'm sending the follwoing query to mysql from a php script: ... -
Trouble with database query
Hi, THIS (Below) error keeps coming. I'm just trying to make a normal login page. It LOOKS fine to me, I've groomed it for bad spaces and... -
Trouble getting data to my DB from the cfinput tag query
if you simply view the screen shots linked here, http://www.e-nationmusic.com/code_views/insert_data.htm which are at the bottom of the entire code... -
SafariTECH #2
Re: Trouble with url variable in query
Sometimes teh line reference is indication of the error, and sometimes it is
indication of the last place everything made sense.
I think it actually may be the latter and the issue is in Line 10.
Access has a few quirky things with it that are different from standard SQL.
Is the "tblItems.Available" field a YES/NO field? If so, then it needs to read:
10 : AND tblItems.Available = 1
If it is any string field where it is actually looking for the word "TRUE",
you need to use single quotes, not double:
10 : AND tblItems.Available = 'True'
If the problem is actually in Line 9 thyen it is because you are specifying a
string variable but have no single quotes around the output from the
cfqueryparam. In standard SQL (ie MSSQL) you can actually get away with not
usuing proper quotes etc and the server will figure it out, but MS ACCESS won't
allow it.
Without the actual database to run the tests against, these would be my best
suggestions for now.
SafariTECH Guest
-



Reply With Quote

