Saturday 15 January 2011

How to convert sql type double-precision in c# -


I have database access, and one of the fields is double exact, generally if I use text box 1.71 or 1, Setting in 71, the field should be 1.71 in the database.

But if I execute the query the value of acces'field is 171 !! public command string QUERY = @ "update TBLART SET TBLART.COST = @Cost WHERE TBLART.CODE = '1'"; Var param = new dynamicParameters (); Var cost = totalCost.Replace (',', '.'); // Total Tag is a textbox absolute. Add ("cost", double purse (cost), db type double); GSMMC.exe (QUERY, ultimate);

Am I wrong? Thank you.

double. Purse will use the culture of the current thread by default, I doubt uses its current culture. " As a group differential.

Two options:

  • Continue using Change as you are already doing, but then specify CultureInfo . Unchanging culture at the time of parsing
  • Remove the replacement, and use only the culture of the current thread while parsing the original value. It depends on the culture that is suitable for the user, but maybe this is a better solution when this is the case. (Otherwise, someone who is entering "1,234.56" will get a parse error if the value of "slightly more than 1234" is.)

No comments:

Post a Comment