Solved

Invalid data '' for CFSQLTYPE CF_SQL_INTEGER

Posted on 2008-10-01
10
1,457 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
[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
  • 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
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Internal DNS Zone Issue 13 92
IIS 8.5 2 54
Use System DSN 6 95
SonicWall port forward 4 28
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
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.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

734 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