Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 591317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:37:19+00:00 2026-05-13T15:37:19+00:00

A form field value like 45,234 is to be inserted into the DB as

  • 0

A form field value like 45,234 is to be inserted into the DB as 45234. When I try to do insert for 45,234, all it gets into the DB is 0.Note:- I am able to insert 45.234as 45.234 in the SQL DB.

The form field is named costOfShares, which is to be inserted into the table ShareVales (SQL Server 2005). I am using CF8.

SQL

table:-ShareVales; field:-costOfShares; DataType:-float

ColdFusion (form page)

<li>
  <cfinput size="8" maxlength="20" name="costOfShares" 
    id="costOfShares" value="#share.GetcostOfShares()#">
</li>

Share.cfc:-

<cfcomponent> 
    <cfscript> Variables.CostOfShare </cfscript> 
<cffunction name="GetCostOfShare" returntype="numeric" access="public" output="false">         
   <cfscript> variables.CostOfShare; </cfscript>
</cffunction>

<cffunction name="SetCostOfShare" retuntype="void" access="public" output="false">    
   <cfargument name="costOfShare" type="string"  required="true">
      <cfscript> variables. costOfShare = arguments. costOfShare; </cfscript>
  </cffunction>
</cfcomponent> 

ColdFusion (query page)

  <cffunction>
    <cfargumnet>
    <cfquery …>
      INSERT INTO ShareVales(shareUnitId, costOfShares) 
      VALUES (
        <cfqueryparam cfsqltype="cf_sql_integer"
                      value="#arguments.share.GetshareUnitId()#">,
        <cfqueryparam cfsqltype="cf_sql_float"
                      value="#arguments.share.GetcostOfShares()#">);
    </cfquery>
</cffunction>

When I use the following directly in the Query Editor:

INSERT into share(setCostOfShare)
values(Cast(replace('5,322,444',',','') as float))

it succeeds. The error is while using cfquery/cfqueryparam in the ColdFusion template.

So, how do insert the 45234 when the form field costOfShares contains a value with commas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:37:20+00:00Added an answer on May 13, 2026 at 3:37 pm

    If they type a comma, strip it out first before trying to insert.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rails form with a datetime_select field. When I try to submit
Every time I have to build a form with a DateTime field I try
I try to set some hidden form field values with an onclick event. Ok,
I need to determine the ID of a form field from within an action
I have a field in my form labeled Name that will contain both the
How can I convert a varchar field of the form YYYYMMDD to a datetime
In a Django form, how do I make a field read-only (or disabled)? When
I am trying to create a form in Rails 2.2.2 that populates a field
I am trying to set a default value for a text field used for
I'm creating a form elements template file in PHPTAL. I would like to be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.