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
The sql error is a comma.
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
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.
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
Copy link to clipboard
Copied
Never mind. Did not see the response before posting ..
Copy link to clipboard
Copied
Well: your posting was good advice too!
The best way to learn stuff is to RTFM, after all.
--
Adam
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 ..
Copy link to clipboard
Copied
Thanks a ton guys!
I pushed through and sorted things out
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
Copy link to clipboard
Copied
The sql error is a comma.