Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2003-12-11
16
Medium Priority
?
248 Views
Last Modified: 2013-12-24
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
0
Comment
Question by:jag5311
16 Comments
 
LVL 33

Expert Comment

by:hongjun
ID: 9926337
try include a single quote for date field as well.

articledate='#FORM.articledate#',


hongjun
0
 
LVL 12

Expert Comment

by:jyokum
ID: 9926354
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
 
LVL 17

Expert Comment

by:anandkp
ID: 9926661
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
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.

 

Author Comment

by:jag5311
ID: 9928541
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
 

Author Comment

by:jag5311
ID: 9928896
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
 
LVL 12

Expert Comment

by:jyokum
ID: 9929094
did you check all your column names? nothing misspelled?
0
 

Author Comment

by:jag5311
ID: 9929118
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
 
LVL 12

Expert Comment

by:jyokum
ID: 9929267
show us your insert statement
0
 

Author Comment

by:jag5311
ID: 9929525
<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
 

Author Comment

by:jag5311
ID: 9930312
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
 
LVL 12

Expert Comment

by:jyokum
ID: 9930333
doesn't really matter what the format is, just use cfqueryparam and the appropriate sql type and it will work
0
 

Author Comment

by:jag5311
ID: 9930398
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
 

Author Comment

by:jag5311
ID: 9930409
File edit,

the 2nd link should be

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

Sorry
0
 

Author Comment

by:jag5311
ID: 9934250
anyone?
0
 
LVL 12

Accepted Solution

by:
jyokum earned 500 total points
ID: 9934302
like I said before... check your column spelling!

you misspelled gameID

UPDATE articles SET gamedID

should be

UPDATE articles SET gameID
0
 

Author Comment

by:jag5311
ID: 9935525
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

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question