Getting a TOO FEW PARAMETERS error. Can't figure it out

Here is some of the error code

Error Executing Database Query.
[MERANT][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.

The Error Occurred in C:\CFusionMX\wwwroot\gamecube\article_edit.cfm: line 14

12 : postedemail='#TRIM(FORM.postedemail)#'
13 : WHERE articleID=<cfqueryparam value="#FORM.articleID#" cfsqltype="cf_sql_integer">
14 : </CFQUERY>

SQL UPDATE articles SET gamedID=1, typeID=5, articletitle='New Metroid Preview', articletext='Whoa, new one baby', articledescription='New one', articledate=5/5/93, postedby='New one', postedemail='New one' WHERE articleID= (param 1)


Now, I have a page that is used for inserting/updating depending on the variables being passed.

Well, it has no problem inserting information into a database, but I am receiving the above error when updating and I can't figure it out for the life of me.

Here is the code that seems to be in the problem.

<cfset EditMode=IsDefined("FORM.articleID")>
<cfif EditMode>
<CFQUERY datasource="#dsn#">
UPDATE articles
SET gamedID=#FORM.gameID#,
typeID=#FORM.articletypes#,
articletitle='#TRIM(FORM.articletitle)#',
articletext='#TRIM(FORM.articletext)#',
articledescription='#TRIM(FORM.articledescription)#',
articledate=#FORM.articledate#,
postedby='#TRIM(FORM.postedby)#',
postedemail='#TRIM(FORM.postedemail)#'
WHERE articleID=<cfqueryparam value="#FORM.articleID#" cfsqltype="cf_sql_integer">
</CFQUERY>

Well, as you can see, it appears I am using only 1 parameter, articleID=#FORM.articleID#, but I can't figure out why its giving me an error.

ANy help
Thanks
Bryan
jag5311Asked:
Who is Participating?
 
jyokumCommented:
like I said before... check your column spelling!

you misspelled gameID

UPDATE articles SET gamedID

should be

UPDATE articles SET gameID
0
 
hongjunCommented:
try include a single quote for date field as well.

articledate='#FORM.articledate#',


hongjun
0
 
jyokumCommented:
use cfqueryparam for all your fields and make sure that you have all your columns spelled correctly

<CFQUERY datasource="#dsn#">
UPDATE articles
SET gamedID=<cfqueryparam value="#FORM.gameID#" cfsqltype="cf_sql_integer">,
typeID=<cfqueryparam value="#FORM.articletypes#" cfsqltype="cf_sql_integer">,
articletitle=<cfqueryparam value="#TRIM(FORM.articletitle)#" cfsqltype="cf_sql_varchar">,
articletext=<cfqueryparam value="#TRIM(FORM.articletext)#" cfsqltype="cf_sql_varchar">,
articledescription=<cfqueryparam value="#TRIM(FORM.articledescription)#" cfsqltype="cf_sql_varchar">,
articledate=<cfqueryparam value="#FORM.articledate#" cfsqltype="cf_sql_date">,
postedby=<cfqueryparam value="#TRIM(FORM.postedby)#" cfsqltype="cf_sql_varchar">,
postedemail=<cfqueryparam value="#TRIM(FORM.postedemail)#" cfsqltype="cf_sql_varchar">
WHERE articleID=<cfqueryparam value="#FORM.articleID#" cfsqltype="cf_sql_integer">
</CFQUERY>
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
anandkpCommented:
Looks to me that in ur SQl statement

SQL UPDATE articles SET gamedID=1, typeID=5, articletitle='New Metroid Preview', articletext='Whoa, new one baby', articledescription='New one', articledate=5/5/93, postedby='New one', postedemail='New one' WHERE articleID= (param 1)

the "," in ur articletext value = 'Whoa, new one baby' - is the reason for error

Like Jyokum suggested - using CFqueryparam for all ur fields wld help u bypass this & avoid the error !

Also chkup on
1. non-nullable fields [chk if relavent data is passed for not null fields]
2. the value of ArticleID ... I hope thats not getting goofed up some where :)
0
 
jag5311Author Commented:
Thanks for the help, I will give them a try, but that is weird.  I have another site that uses the same format for the update but it works almost exactly how I have this one setup, and I get no problems.

I don't see why the "comma" in Whoa, new one baby should cause the problem.

I will let you guys know whats going on.

Also, I dno't know how the value of articleID would be goofing since its being passed to the next page

On the previous page before I hit submit, I am able to go up to VIEW SOURCE and I can see that it has the value set to articleID=1, so I know its there

0
 
jag5311Author Commented:
Hi,

well I have made the changes, and I still get the error.

It appears that I am always 1 parameter short of fullfilling what coldfusion wants.  In the first instance, it wanted 2 parameters and I was only providing 1, now it wants 10, and I am only providing 9 (after all of the CFqueryparam stuff)

I have a feeling this has to do with the articledate

Also, the article title wasn't the problem, because I am having the same error with titles that have no comma's.
0
 
jyokumCommented:
did you check all your column names? nothing misspelled?
0
 
jag5311Author Commented:
Nope, I couldn't find anything.

Like I said, i can use INSERT just fine, its when UPDATE is used that gives me the problem
0
 
jyokumCommented:
show us your insert statement
0
 
jag5311Author Commented:
<CFQUERY datasource="#dsn#">
INSERT INTO articles (gameID,
                                typeID,
              articletitle,
            articletext,
             articledescription,
            articledate,
             postedby,
              postedemail )
VALUES ( #FORM.gameID#,
             #FORM.articletypes#,
             '#TRIM(FORM.articletitle)#',
             '#TRIM(FORM.articletext)#',
             '#TRIM(FORM.articledescription)#',
             #FORM.articledate#,
             '#TRIM(FORM.postedby)#',
             '#TRIM(FORM.postedemail)#' )
</cfquery>
0
 
jag5311Author Commented:
I have an idea, how about we start from scratch and you guys tell me exactly what I need to do in order for Access and Coldfusion to work in conjunction with each other with no problems

In Access, what do my preferences need to be, meaning the DATA TYPE, and the FORMAT.

In Coldfusion, what do I need my DateFormat to be?  Do I need it at all?

Lets just get a mimimal one working, and we can work from there.

Thanks
Bryan
0
 
jyokumCommented:
doesn't really matter what the format is, just use cfqueryparam and the appropriate sql type and it will work
0
 
jag5311Author Commented:
well, something is wrong

Here are two files

1.  This is the actual Form file, where it will prefill or be blank depending on the articleID that is passed.  This is just the top portion
http://www.btkdesigns.com/editform.htm

This is the input that I use on the page to show the article date
<input name="articledate" size="25" type="text" value="#DateFormat(articledate, "yyyy-mm-dd")#" />

2.  This is the code for the insert and update section after the form in part 1 would have been submitted
http://www.btkdesigns.com/edit-insert.htm

I hope this can shine some light

Another problem I am having is when I INSERT an article, all looks fine and it inserts just fine, but when I go to the edit screen to check out how everything looks in the form, if I typed a date of

1995-12-05

it shows up as  

1895-06-24   or something stupid like that.
0
 
jag5311Author Commented:
File edit,

the 2nd link should be

http://www.btkdesigns.com/insert-edit.htm

Sorry
0
 
jag5311Author Commented:
anyone?
0
 
jag5311Author Commented:
Thank you jyokum.

Well, after looking at code all day, my head starts swimming and things sometimes get passed.  Thanks for the observation.

Bryan
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.