Solved

Invalid data '' for CFSQLTYPE CF_SQL_INTEGER

Posted on 2008-10-01
10
1,451 Views
Last Modified: 2013-12-24
Hello experts.
Using my query i have the error :Invalid data '' for CFSQLTYPE CF_SQL_INTEGER
I get this error for a value with cfparam:
<cfparam name="Form.TUVmonth" default="">
The query is like:
<cfquery name="InsertArtikel" datasource="#dsn#">
INSERT INTO ARTIKEL (.........TUVmonth)
Values (............,<cfqueryparam value="#Form.TUVmonth#" cfsqltype="cf_sql_integer">)
</cfquery>
The type in DB is int.
(i have this problem only when i don't put any value in the formfield Tuvmonth.)
Any help?
0
Comment
Question by:Panos
  • 5
  • 5
10 Comments
 
LVL 19

Accepted Solution

by:
erikTsomik earned 500 total points
ID: 22617143
it probably because the form variable is blank you can do the following
<cfif NOT isNumeric(FORM.TUVmonth)>
   <cfprocparam type="in" cfsqltype="cf_sql_integer" value="0">
<cfelse>
   <cfprocparam type="in" cfsqltype="cf_sql_integer" value="#FORM.TUVmonth#">
</cfif>

or even easier
<cfprocparam type="in" cfsqltype="cf_sql_integer" value="#val( FORM.TUVmonth)#">
0
 
LVL 2

Author Comment

by:Panos
ID: 22617219
Hi
If i use the cfprocparam in the query must i use the cfparam too?
(<cfparam name="Form.TUVmonth" default="">
<cfquery name="InsertArtikel" datasource="#dsn#">
INSERT INTO ARTIKEL (.........TUVmonth)
Values (............,<cfprocparam type="in" cfsqltype="cf_sql_integer" value="#val( FORM.TUVmonth)#">)
</cfquery>)
0
 
LVL 19

Expert Comment

by:erikTsomik
ID: 22617258
try not to use it
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
LVL 2

Author Comment

by:Panos
ID: 22617343
I have this error:
 Context validation error for tag cfprocparam.
The tag must be nested inside a cfstoredproc tag
0
 
LVL 19

Expert Comment

by:erikTsomik
ID: 22617357
use cfqueryparam
0
 
LVL 2

Author Comment

by:Panos
ID: 22617441
Hi
This is working without cfparam.
Is this OK?
(<cfqueryparam cfsqltype="cf_sql_integer" value="#val(FORM.TUVmonth)#">)
0
 
LVL 19

Expert Comment

by:erikTsomik
ID: 22617460
yes that is perfect
0
 
LVL 2

Author Comment

by:Panos
ID: 22617466
And something else.
If i want to have default values f.e for checkboxes the value 0,is this wrong to use the cfparam tag?
0
 
LVL 19

Assisted Solution

by:erikTsomik
erikTsomik earned 500 total points
ID: 22617574
Use the same approach
<cfif NOT isNumeric(FORM.TUVmonth)>
   <cfprocparam type="in" cfsqltype="cf_sql_integer" value="0">
<cfelse>
   <cfprocparam type="in" cfsqltype="cf_sql_integer" value="#FORM.TUVmonth#">
</cfif>
0
 
LVL 2

Author Closing Comment

by:Panos
ID: 31502072
Hi
Thank you for your help
regards
panos
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Hosting a website using port 443 SSL CA using Wampserver 2 How to: 6 53
How can I install php on a ngxin server on droplet 5 134
CFFILE upload help 98 158
SSL sertificate 5 65
A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

786 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