ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 23rd, 2004, 05:34 PM
jedimasta jedimasta is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 10 jedimasta User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 19 m 30 sec
Reputation Power: 0
Question cfgridupdate...not updating

This isn't your standard "can't find grid error". In fact I was only able to find once instance of the error repeated on the net and it existed in a cached google site, no longer available live.

Code:
<cfform action="act_Collectors.cfm" Method="post">

<cfgrid insert="yes" selectcolor="##FFFF00" delete="yes" name="CollectorGrid" height="450" width="650" query="qGetList" selectmode="edit" rowheaders="no" colheaders="yes" colheaderbold="yes" colheaderalign="center">

<cfgridcolumn display="no" name="RepID" select="no">
<cfgridcolumn header="Extension" select="yes" type="string_nocase" name="Ext" width="90">
<cfgridcolumn header="Name" select="yes" name="Name" width="240">
<cfgridcolumn header="Phone Number" select="yes" name="Phone" width="100" dataalign="center">
<cfgridcolumn header="Service Area" select="yes" name="AreaID" width="90" dataalign="center" values="#AreaIDList#" valuesdisplay="#AreaNameList#">
<cfgridcolumn header="Special Notes" select="yes" name="Notes" width="100">

</cfgrid>
<p><input type="submit" value="Submit Changes">
</cfform>


There's the basics.
The RepID variable is the PrimaryKey in the SQL db. It's an auto-incrementing number, as is standard. Using the cfgrid interface, users are able to update and delete records without problems, but when they try to add records an error occurs:

Code:
Error Executing Database Query.  
Invalid data for CFSQLTYPE CF_SQL_INTEGER.  
  
The error occurred in D:\wwwroot\customerservice\Collectors\act_Collectors.cfm: line 1
 
1 : <cfgridupdate grid="CollectorGrid" datasource="Field_Collectors" tablename="tCollectors" keyonly="yes">
2 : <cflocation url="dsp_Collectors.cfm">

 

--------------------------------------------------------------------------------
 
SQL   insert into tCollectors (RepID, Ext, Name, Phone, AreaID, Notes) values ( (param 1) , (param 2) , (param 3) , (param 4) , (param 5) , (param 6) ) 
DATASOURCE   Field_Collectors 


If I remove the RepID key from the cfgrid and try, new records are inserted properly, but updating and deleting might as well be disabled entirely without a Key to work from. Does anyone see a problem in my code?

Reply With Quote
  #2  
Old July 23rd, 2004, 06:16 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,681 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 22 m 41 sec
Reputation Power: 53
It looks like the SQL is trying to insert something other than an integer into the one of the fields. Can you take the exact same SQL and run it from the SQL query analyzer? Does the insert work there?
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old July 23rd, 2004, 06:33 PM
jedimasta jedimasta is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 10 jedimasta User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 19 m 30 sec
Reputation Power: 0
yeah, if I enter the fields in manually it all works. I've narrowed it down to being the RepID that's causing the problem, and removing it allows me to add as many rows using cfgrid just fine, but nullifies the ability to update or delete fields. Essentially, when a row is inserted, the DB should be adding the primary key, not the grid, due to auto increment, but it seems as if theres a conflict.

Reply With Quote
  #4  
Old July 23rd, 2004, 08:07 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,681 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 22 m 41 sec
Reputation Power: 53
If SQL Server is generating the primary key, then the problem is probably that when you try to do an insert, an empty string (or maybe a number that's already in use as a key) is being entered, and SQL Server is complaining. Can you look at the actual SQL being used in the debugging output and see what value is being used during the insert? You could also try using cftry/cfcatch to catch the database exception and look at the SQL being used from within the cfcatch object.

I don't use cfgrid so I don't have too much to offer. To me, using cfgrid to insert fields (or update them for that matter) seems like a bad idea because as far as I can tell there's no way to validate any of the data being inserted/updated.

Could you use the grid to edit and delete fields, but let the user use a form to enter new records?

Reply With Quote
  #5  
Old November 22nd, 2004, 08:43 AM
amitsr amitsr is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 1 amitsr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Have you found the solution?????

Please let me know what is the solution for this if you have been able to find a solution.

Thanks!


Quote:
Originally Posted by jedimasta
This isn't your standard "can't find grid error". In fact I was only able to find once instance of the error repeated on the net and it existed in a cached google site, no longer available live.

Code:
<cfform action="act_Collectors.cfm" Method="post">

<cfgrid insert="yes" selectcolor="##FFFF00" delete="yes" name="CollectorGrid" height="450" width="650" query="qGetList" selectmode="edit" rowheaders="no" colheaders="yes" colheaderbold="yes" colheaderalign="center">

<cfgridcolumn display="no" name="RepID" select="no">
<cfgridcolumn header="Extension" select="yes" type="string_nocase" name="Ext" width="90">
<cfgridcolumn header="Name" select="yes" name="Name" width="240">
<cfgridcolumn header="Phone Number" select="yes" name="Phone" width="100" dataalign="center">
<cfgridcolumn header="Service Area" select="yes" name="AreaID" width="90" dataalign="center" values="#AreaIDList#" valuesdisplay="#AreaNameList#">
<cfgridcolumn header="Special Notes" select="yes" name="Notes" width="100">

</cfgrid>
<p><input type="submit" value="Submit Changes">
</cfform>


There's the basics.
The RepID variable is the PrimaryKey in the SQL db. It's an auto-incrementing number, as is standard. Using the cfgrid interface, users are able to update and delete records without problems, but when they try to add records an error occurs:

Code:
Error Executing Database Query.  
Invalid data for CFSQLTYPE CF_SQL_INTEGER.  
  
The error occurred in D:\wwwroot\customerservice\Collectors\act_Collectors.cfm: line 1
 
1 : <cfgridupdate grid="CollectorGrid" datasource="Field_Collectors" tablename="tCollectors" keyonly="yes">
2 : <cflocation url="dsp_Collectors.cfm">

 

--------------------------------------------------------------------------------
 
SQL   insert into tCollectors (RepID, Ext, Name, Phone, AreaID, Notes) values ( (param 1) , (param 2) , (param 3) , (param 4) , (param 5) , (param 6) ) 
DATASOURCE   Field_Collectors 


If I remove the RepID key from the cfgrid and try, new records are inserted properly, but updating and deleting might as well be disabled entirely without a Key to work from. Does anyone see a problem in my code?

Reply With Quote
  #6  
Old July 26th, 2005, 08:26 AM
mcory mcory is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 1 mcory User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 40 sec
Reputation Power: 0
Same exact problem

I am running into the EXACT same problem. Was a solution ever discovered?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > cfgridupdate...not updating


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT