Solved

Invalid data '' for CFSQLTYPE CF_SQL_INTEGER

Posted on 2008-10-01
10
1,447 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
 
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

896 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

12 Experts available now in Live!

Get 1:1 Help Now