?
Solved

Invalid data '' for CFSQLTYPE CF_SQL_INTEGER but there isn't any integer.

Posted on 2011-09-19
4
Medium Priority
?
1,519 Views
Last Modified: 2012-05-12
Hello, I'm getting an error
Invalid data '' for CFSQLTYPE CF_SQL_INTEGER. 

Open in new window

but the line I am getting the error at is
<cfqueryparam value="#form.comments#" cfsqltype="CF_SQL_VARCHAR">

Open in new window

the field I am passing on from the previous page is
<textarea name="comments" cols="40" rows="3"></textarea>

Open in new window

I am typing a value into it and it is defined as a "varchar(MAX)" in the database.  The only CF_SQL_INTEGER 's I have in my code are 2 that are about 30-35 lines away from where it is giving me this error and they match up with the database correctly.

I saw on another site that if the value is blank it will usually throw up this error but only if it is an interger.  It said for varchars it will automatically set it as "" if it is blank. (This was used as a quick fix)

One thread http://www.experts-exchange.com/Software/Server_Software/Web_Servers/ColdFusion/Q_21758614.html dealt with a similar issue.  But again its with intergers.  Is it possible the error is on a different line then stated? Or am I missing something that is staring me right in the face?
0
Comment
Question by:andrewaiello
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 2000 total points
ID: 36561801
>> Is it possible the error is on a different line then stated?

VERY possible.  Happens to me all the time.  Can you post the full query?
0
 
LVL 1

Author Comment

by:andrewaiello
ID: 36561845
Yeah, I found it, it was something on a different line on a different page, and staring me right in the face.  Annoying dreamweaver followed a mouse drag or something and just decided that meant to delete 3  lines of code...I have to switch over to something else.

A select box of one of my integer type fields got deleted.
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 36561855
It appears that the problem is with the cfqueryparam statement that has the INTEGER type.  If the value can be empty, then this will throw an error, you can avoid that by adding either val() around the variable that may be blank (as in val(form.myNumber)   )  or adding  this paramter into the cfqueryparam tag:

  NULL="#NOT len(form.myNumber)#"

0
 
LVL 52

Expert Comment

by:_agx_
ID: 36561865
Yep, that's what I use - just with IsNumeric instead of Len()
0

Featured Post

How to Create Failover DNS Record Sets in Route 53

Route 53 has the ability to easily configure DNS record sets specifically for failover scenarios. These failover record sets can be configured to failover to full-blown deployments in other regions or to a static HTML page that informs your customers of the issue.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question