Solved

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

Posted on 2011-09-19
4
1,477 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 500 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

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

691 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