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

CFC DB Inserts and calculations

Explorer ,
Jun 19, 2007 Jun 19, 2007

Copy link to clipboard

Copied

I keep getting a DB CFC error. For some reason CF freaks out when I enter negative numbers into a flash form an pass it to a CFC has anyone else had this problem before? If so can anyone help me figure this out. Again it only freaks out when I enter negative numbers (example: -28).

Sample Code:
TOPICS
Advanced techniques

Views

745

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
Advocate ,
Jun 19, 2007 Jun 19, 2007

Copy link to clipboard

Copied

Can you post the error you are receiving?

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
Explorer ,
Jun 19, 2007 Jun 19, 2007

Copy link to clipboard

Copied

oh is a CFC error which is pointing to the Database insert query, and yes I do realize that the code I posted has it comment out but this is not like this on the original file, I think the issue is that coldfusion has issues doing calculations on negative numbers, it should not but this seems to be the case. I even try doing a number format but that won't work because of "-" sign.

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
Advocate ,
Jun 19, 2007 Jun 19, 2007

Copy link to clipboard

Copied

Without seeing the exact error message, its sort of hard to troubleshoot, but the only thing that looks like it would possibly cause an error is the CONVERT() method calls. Since Convert() is a SQL function, the error would be generated by your database and not ColdFusion. Make sure you have the syntax correct. Try removing the single quotes.

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
Explorer ,
Jun 19, 2007 Jun 19, 2007

Copy link to clipboard

Copied

all it says is this:

"Error while calling CFC:Error Executing Database query"

I also tried removing the quotes and it did not work. the Convert function is correct because it works just fine when I do not enter negative number in the form and submit.

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
Advocate ,
Jun 20, 2007 Jun 20, 2007

Copy link to clipboard

Copied

Have you tried recreating the CF logic on its own CF page (i.e. outside on a CFC) to see if you get a more specific error?

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
Advocate ,
Jun 20, 2007 Jun 20, 2007

Copy link to clipboard

Copied

Also, have you tried calling the CFC from something other than a flash form? I wonder if the flash form is sending another character for the "-" than your DB is expecting. Does it cause the same error when you try to recreate it in a normal HTML form?

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
Explorer ,
Jun 20, 2007 Jun 20, 2007

Copy link to clipboard

Copied

LATEST
Hey I figured out what was wrong with it. It was this "<cfset svc_tech_cont = #NumberFormat(svc_tech_cont, "___.__")#>" The fact that I was doing a numberformat function on it. for some reason SQL Server does not like it. Once I removed it the damn thing works like a charm. Thanks for all your help truly appreciate it.

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