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

update text in the table from cfc

Engaged ,
Mar 27, 2014 Mar 27, 2014

Copy link to clipboard

Copied

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,

Views

407

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
Guide ,
Mar 27, 2014 Mar 27, 2014

Copy link to clipboard

Copied

iccsi,

Can you post the *exact* code you used to call the CFC function?

-Carl V.

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
Engaged ,
Mar 27, 2014 Mar 27, 2014

Copy link to clipboard

Copied

LATEST

Thanks for the information and help,

I found that it is a bug in the stroed procedure,

Thanks again for helping,

Regards,

Iccsi,

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