title: ColdFusion: How to insert numbers( having a 'comma'(,)/ currently iserted as 0) from form fields into the database
body: <p>A form field value like <code>45,234</code> is to be inserted into the DB as <code>45234</code>. When I try to do insert for <code>45,234</code>, all it gets into the DB is <code>0</code>.Note:- I am able to insert <code>45.234</code>as 45.234 in the SQL DB. </p>
  
  <p>The form field is named <code>costOfShares</code>, which is to be inserted into the table <code>ShareVales</code> (SQL Server 2005). I am using CF8.</p>
  
  <p>SQL</p>
  
  <pre><code>table:-ShareVales; field:-costOfShares; DataType:-float
  </code></pre>
  
  <p>ColdFusion (form page)</p>
  
  <pre><code>&lt;li&gt;
    &lt;cfinput size="8" maxlength="20" name="costOfShares" 
      id="costOfShares" value="#share.GetcostOfShares()#"&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>Share.cfc:-</p>
  
  <pre><code>&lt;cfcomponent&gt; 
      &lt;cfscript&gt; Variables.CostOfShare &lt;/cfscript&gt; 
  &lt;cffunction name="GetCostOfShare" returntype="numeric" access="public" output="false"&gt;         
     &lt;cfscript&gt; variables.CostOfShare; &lt;/cfscript&gt;
  &lt;/cffunction&gt;
  
  &lt;cffunction name="SetCostOfShare" retuntype="void" access="public" output="false"&gt;    
     &lt;cfargument name="costOfShare" type="string"  required="true"&gt;
        &lt;cfscript&gt; variables. costOfShare = arguments. costOfShare; &lt;/cfscript&gt;
    &lt;/cffunction&gt;
  &lt;/cfcomponent&gt; 
  </code></pre>
  
  <p>ColdFusion (query page)</p>
  
  <pre><code>  &lt;cffunction&gt;
      &lt;cfargumnet&gt;
      &lt;cfquery …&gt;
        INSERT INTO ShareVales(shareUnitId, costOfShares) 
        VALUES (
          &lt;cfqueryparam cfsqltype="cf_sql_integer"
                        value="#arguments.share.GetshareUnitId()#"&gt;,
          &lt;cfqueryparam cfsqltype="cf_sql_float"
                        value="#arguments.share.GetcostOfShares()#"&gt;);
      &lt;/cfquery&gt;
  &lt;/cffunction&gt;
  </code></pre>
  
  <p>When I use the following directly in the Query Editor:</p>
  
  <pre><code>INSERT into share(setCostOfShare)
  values(Cast(replace('5,322,444',',','') as float))
  </code></pre>
  
  <p>it succeeds. The error is while using cfquery/cfqueryparam in the ColdFusion template.</p>
  
  <p>So, how do insert the <code>45234</code> when the form field <code>costOfShares</code> contains a value with commas?</p>