Solved

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

Posted on 2011-09-19
4
1,401 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
Comment Utility
>> 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
Comment Utility
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
Comment Utility
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_
Comment Utility
Yep, that's what I use - just with IsNumeric instead of Len()
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

728 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now