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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hongjunCommented:
try include a single quote for date field as well.

articledate='#FORM.articledate#',


hongjun
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>
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 :)
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

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

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.
jyokumCommented:
did you check all your column names? nothing misspelled?
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
jyokumCommented:
show us your insert statement
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>
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
jyokumCommented:
doesn't really matter what the format is, just use cfqueryparam and the appropriate sql type and it will work
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.
jag5311Author Commented:
File edit,

the 2nd link should be

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

Sorry
jag5311Author Commented:
anyone?
jyokumCommented:
like I said before... check your column spelling!

you misspelled gameID

UPDATE articles SET gamedID

should be

UPDATE articles SET gameID

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.