title: Error converting varchar to float asp.net
body: <p>I'm trying to pull data from a bunch of text boxes and then insert them into a database and all is well except for two, one is  that if they are null they error but that's not the concern right now.</p>
  
  <p>When I have a textbox that is supposed to take a number it says it cannot convert varchar to float. The inserts work if I do them directly in SQL Server though (using SQL Server 2008) so I know that it's something in the code.</p>
  
  <p>My textbox is just a simple:</p>
  
  <pre><code>&lt;asp:TextBox id="CID" runat="server"&gt;&lt;/asp:TextBox&gt;
  </code></pre>
  
  <p>And the code I have for pulling the information from the textbox is:</p>
  
  <pre><code>float custID = float.Parse(CID.Text);
  </code></pre>
  
  <p>I'm new to C# so if you could help me simply put that would be better but any help works. thx    </p>
  
  <p>Edit: this is the line the error I get: </p>
  
  <pre><code>Line 63: 
  Line 64:         sqlConnection1.Open();
  Line 65:         cmd.ExecuteNonQuery();
  Line 66:         sqlConnection1.Close();
  Line 67:     }
  </code></pre>
  
  <p>Code requested:</p>
  
  <pre><code>cmd.CommandText = "INSERT INTO Customer VALUES('@custID', @mastName, @custName,      @addrLn1, @addrLn2, @cCity, @cState, @cZip, @cZip4, @cCountry, @cusSince, @renewalDate, @cNotes, @salesRep, @conMem, @ilsProd, @numbSites, @guardItEsc)";
  
      cmd.CommandType = CommandType.Text;
      cmd.Connection = sqlConnection1;
  </code></pre>
  
  <p>Parsed w/ parameter:</p>
  
  <pre><code>float custID = float.Parse(CID.Text);
      cmd.Parameters.AddWithValue("@custId", custID);
  </code></pre>