Solved

Invalid data '' for CFSQLTYPE CF_SQL_INTEGER

Posted on 2008-10-01
10
1,444 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

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

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

15 Experts available now in Live!

Get 1:1 Help Now