It's probably not Cfqueryparam... This often happens when you change schemas
on the Db... The JDBC subsystem caches the Database schema - which to you
looks like "cola,colb" but JDBC looks like "position 1, position 2" .. When
you add a column for example, the column ids are switched or shifted. This
results in a data type mismatch.  Check out this blog post:

http://mkruger.cfwebtools.com/index.cfm?mode=alias&alias=dbschemaChange

There are a number of work arounds (see the comments) including adding
something to the query to get JDBC to go out and refresh the schema for that
table.

-mark
 

-----Original Message-----
From: Everett, Al (NIH/NIGMS) [C] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 16, 2006 10:07 AM
To: CF-Talk
Subject: RE: cfqueryparam acting up

A space perhaps?

<cfqueryparam value="#trim(URL.productID)#" cfsqltype="cf_sql_integer"
/>


-----Original Message-----
From: Richard Cooper
Sent: Wednesday, August 16, 2006 10:51 AM
To: CF-Talk
Subject: cfqueryparam acting up

Hi,

I've recently been getting some odd occurrences when using <cfqueryparam>.
For instance I've have a table products. Everything was fine until recently
when a product was updated via a CMS system.

Each product that was edited after this point had this error when attempted
to view in a listing:

[code]
[Macromedia][SQLServer JDBC Driver]Value can not be converted to requested
type.  
  
The error occurred in W:\inetpub\wwwroot\testsite\www\untitled.cfm: line
4
 
2 : SELECT *
3 : FROM products
4 : WHERE productID = <cfqueryparam value="#URL.productID#"
cfsqltype="cf_sql_integer" />
5 : </cfquery>
6 : 
------------------------------------------------------------------------
--------
SQL    SELECT * FROM products WHERE productID = (param 1) 
[/code]

For example I went to ?productID=285 and it would break but
?productID=395 would be fine....both of which a integers, so both should
work. I removed the cfqueryparam to leave:  WHERE productID =
#URL.productID# and everything worked fine?

To get it working I have to change the SELECT * and list all of the fields
required.

The problem seems to be happening only when using cfqueryparam and only on
columns that are: INTEGER IDENTITY(1,1) PRIMARY KEY

I'm using CF MX 7 & SQL Server 2000 on a windows 2000 platform.

Has anyone else experienced such problems or know if I'm doing something
wrong



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:249998
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to