Solved

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

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 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