|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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? |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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.
|
|
#4
|
|||
|
|||
|
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? |
|
#5
|
|||
|
|||
|
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:
|
|
#6
|
|||
|
|||
|
Same exact problem
I am running into the EXACT same problem. Was a solution ever discovered?
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > cfgridupdate...not updating |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|