Solved

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

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sql Query 4 36
SQL Server - Sum Decimal Columns 11 33
MS SQL Server Modify insert/update update to use MERGE 13 46
sql server select date from a datetime column 10 23
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
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 …

776 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