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

update text in the table from cfc

Engaged ,
Mar 27, 2014 Mar 27, 2014

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,

473
Translate
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

iccsi,

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

-Carl V.

Translate
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
LATEST

Thanks for the information and help,

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

Thanks again for helping,

Regards,

Iccsi,

Translate
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