Quantcast
Viewing all articles
Browse latest Browse all 5794

update text in the table from cfc

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">

</cfstoredproc>

  

 

</cffunction>

 

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,

 

Regards,

 

Iccsi,


Viewing all articles
Browse latest Browse all 5794

Trending Articles