• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Error executing CFC. Parameter index out of range (2 > number of parameters, which is 1)

New Here ,
Jun 27, 2011 Jun 27, 2011

Copy link to clipboard

Copied

Hi,

My CFC component is defined as:

<cffunction name="updateNote" output="false" access="remote"  returntype="void" >

     <cfargument name="notedetails" required="true" type="string" >

     <cfargument name="notename" required="true" type="string" />

   

     <cfquery name="qupdateNote" datasource="notes_db">

           UPDATE

               notes

           SET

               notes.notedetails=<CFQUERYPARAM CFSQLTYPE="CF_SQL_VARCHAR" VALUE="#ARGUMENTS.notedetails#">,

           WHERE

               notename="<CFQUERYPARAM CFSQLTYPE="CF_SQL_VARCHAR" VALUE="#ARGUMENTS.notename#">"

    </cfquery>

</cffunction>

In Flash builder when I test the operation I get this error:

"There was an error while invoking the operation. Check  your server settings and try invoking the operation again.

Reason:  Server error Unable to invoke CFC - Error Executing Database Query. Parameter  index out of range (2 > number of parameters, which is 1)."

Im really quessing that this is something small but right now its causing me to pull my hair out of my head!! Argg. Tried a bunch of things but I know thik im stuck.

Help would be very very appreciated.

Thanks

Views

2.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jun 29, 2011 Jun 29, 2011

The sql error is a comma.

Votes

Translate

Translate
LEGEND ,
Jun 28, 2011 Jun 28, 2011

Copy link to clipboard

Copied

Your SQL is invalid: it has a syntax error in it.

Take a (closer ~) look at it.

It's always best to troubleshoot this stuff with a CF template and a normal web browser because you'll get a better error message and, in the case of SQL errors, it'll show the SQL it's trying to run, and it's easier to spot syntax errors that way.  Plus one can copy and paste the SQL from the debug into an SQL client app and run it, and often it'll highlight exactly where the error is.

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 29, 2011 Jun 29, 2011

Copy link to clipboard

Copied

thanks a ton Adam. cant really find my sql error - i removed the "'s but it still wont work.

can u give me a quick tip on how to use a cf template to create a webpage out of the component.

much appreciated.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 29, 2011 Jun 29, 2011

Copy link to clipboard

Copied

Create test.cfm along these lines:

<cfset myObj = createObject("component", "dotted.path.to.cfc.file")>

<cfset myResult = myObj.myMethod(arg=value1, etc)>

<cfdump var="#myResult#">


Or, really, you could just browse to this:

http://your.domain/path/to/your.cfc?method=yourMethod&arg1=value1 [etc]

Although I dunno which of those two approachs will give you a better error message (indeed, it might be the same).

Try both.

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 29, 2011 Jun 29, 2011

Copy link to clipboard

Copied

Never mind. Did not see the response before posting ..

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 29, 2011 Jun 29, 2011

Copy link to clipboard

Copied

Well: your posting was good advice too!

The best way to learn stuff is to RTFM, after all.

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 29, 2011 Jun 29, 2011

Copy link to clipboard

Copied

The best way to learn stuff is to RTFM, after all.

Yep. I use it most every day. Still pick up new things from it now and then too ..

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 01, 2011 Jul 01, 2011

Copy link to clipboard

Copied

LATEST

Thanks a ton guys!

I pushed through and sorted things out

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 29, 2011 Jun 29, 2011

Copy link to clipboard

Copied

can u give me a quick tip on how to use a cf template to

create a webpage out of the component.

You do not create a web page from the component, you create a CF template that invokes your component using CF code. A template provides greater access to debugging information. But you can also invoke remote components via URL. See the "Using ColdFusion components" section of the documentation for a complete set of examples.

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=buildingComponents_15.html

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 29, 2011 Jun 29, 2011

Copy link to clipboard

Copied

The sql error is a comma.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation