After a dump of the form variables, I only have 1 pricePerAd form variable. I cannot for the life of me figure out what would cause this. I added the ending ) to the insert and that did not do anything. Any more ideas?
Doug ----- Original Message ----- From: "Jerry Johnson" <[EMAIL PROTECTED]> To: "CF-Talk" <[email protected]> Sent: Tuesday, November 28, 2006 7:44 AM Subject: Re: Insert problem (Basic stuff) > Just as a guess, the value is being passed from a form that has TWO of > the variables listed on the form. > > Therefore, the value is getting to this page with both copies, > something like 10,2 > > which, when inserted in a query, appears to be more than one value. > > Either make sure that there is only one, or take the first item off > the list before inserting. > > > > On 11/28/06, Doug Brown <[EMAIL PROTECTED]> wrote: > > I am beating my head. I am inserting a new category and I am getting an error saying There are more columns in the INSERT statement than values specified in the VALUES clause. If I remove the pricePerAd from both the invoke and the query, it works just fine. Am I missing something here? > > > > > > > > <CFINVOKE COMPONENT="components/manageCategories" > > METHOD="CommitMainCategory" > > CategoryID = "0" > > CategoryName = "#Left(form.CategoryName,100)#" > > CategoryDescription = "#Left(form.CategoryDescription,59999)#" > > CategoryImage = "0" > > CatStatus = "1" > > CatPos = "#Val(form.NCatPos)#" > > PricePerAd = "#Val(PricePerAd)#" > > RETURNVARIABLE="thisNewCategoryID"> > > </CFINVOKE> > > > > > > <!---:::Function: Commit Main Category ---> > > <cffunction name="CommitMainCategory" access="public" returntype="numeric" output="no" hint="Commit Main Category"> > > <cfargument name="CategoryID" type="numeric" required="yes"> > > <cfargument name="CategoryName" type="string" required="yes"> > > <cfargument name="CategoryDescription" type="string" required="yes"> > > <cfargument name="CategoryImage" type="string" required="yes"> > > <cfargument name="CatStatus" type="numeric" required="yes"> > > <cfargument name="CatPos" type="numeric" required="no"> > > <cfargument name="pricePerAd" type="string" required="No"> > > > > <cfset var NewCategoryID = ""> > > > > <cfif ARGUMENTS.CategoryID GT 0> > > > > <!--- UPDATE EXISTING CATEGORIES ---> > > > > <CFQUERY NAME="NewCategoryID" DATASOURCE="#APPLICATION.DB#" USERNAME="#APPLICATION.UN#" PASSWORD="#APPLICATION.PW#"> > > UPDATE #APPLICATION.DBPRE#Categories > > SET CategoryName = '#Trim(ARGUMENTS.CategoryName)#', > > CategoryDescription = '#Trim(ARGUMENTS.CategoryDescription)#', > > CategoryImage = '#Trim(ARGUMENTS.CategoryImage)#', > > CatStatus = #Val(ARGUMENTS.CatStatus)#, > > pricePerAd = #Val(ARGUMENTS.pricePerAd)# > > WHERE CategoryID = #Val(ARGUMENTS.CategoryID)# > > </CFQUERY> > > > > <cfset thisNewCategoryID = #Val(ARGUMENTS.CategoryID)#> > > > > <cfelse> > > > > <!--- INSERT NEW ---> > > <CFQUERY NAME="NewCategoryID" DATASOURCE="#APPLICATION.DB#" USERNAME="#APPLICATION.UN#" PASSWORD="#APPLICATION.PW#"> > > SET NOCOUNT ON > > INSERT INTO #APPLICATION.DBPRE#Categories > > (CategoryName, > > CategoryDescription, > > CategoryImage, > > CatStatus, > > CatPos, > > PricePerAd) > > > > VALUES > > ('#Trim(ARGUMENTS.CategoryName)#', > > '#Trim(ARGUMENTS.CategoryDescription)#', > > '#Trim(ARGUMENTS.CategoryImage)#', > > #Val(ARGUMENTS.CatStatus)#, > > #Val(ARGUMENTS.CatPos)#), > > #Val(ARGUMENTS.pricePerAd)# > > Select @@identity as CategoryID > > SET NOCOUNT OFF > > </CFQUERY> > > > > <cfset thisNewCategoryID = #Val(NewCategoryID.CategoryID)#> > > > > </cfif> > > > > <cfreturn thisNewCategoryID> > > </cffunction> > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:261856 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

