2 Replies Latest reply on Mar 27, 2014 9:18 AM by iccsi

    update text in the table from cfc

    iccsi Level 1

      I have a function in cfc file like following to call MS SQL server stored procedure.

      The stored procedure check ID if ID exists then update table, if not then insert a new record.


      <cffunction name="NewRecord" access="remote">


          <cfargument name ="MyID" required="yes" default="1" hint="My ID">

         <cfargument name ="MyText" required="no" default="" hint="MyText">



      <cfstoredproc datasource="mydatasource" procedure = "mySP">

            <cfprocparam value = "#MyID#" CFSQLTYPE = "cf_sql_integer">

            <cfprocparam value = "#MyText#" CFSQLTYPE = "cf_sql_varchar">






      The insert works if the record does not exist from my click button on cfm file,

      I run the stored procedure works from SSMS works on update and insert.

      I got excute query error when the record exists in the table.

      The update works if I provide integer value for the text field.


      [Macromedia][SQLServer JDBC Driver][SQLServer]Conversion failed when converting the nvarchar value 'test' to data type int.


      For some reason, cfc function consider mytext must use integer instead of text even I declare cf_sql_varchar, but insert works,

      Any suggestins or information is great appreciated,