Hi Brenny,
you need to make sure that if you are parsing user data then you pass in
the Culture in which the data has been formatted so that it is parsed
correctly. For example if you enter an number like 123.45 then if you parse
that as an EN-US culture then the number will be interpretted as 123.45 but
if you parse it as a German format i.e. DE-DE then it will be 12345
For example:
//get the number 123.45
string decimalNumber = this.textBox1.Text;
//parse this as a EN-US culture -> it will be stored in dEnUs as 123.45
decimal dEnUs = Decimal.Parse(decimalNumber, new
System.Globalization.CultureInfo("en-us"));
//parse this as a DE-DE culture it will be parse as 12345
decimal dDeDe = Decimal.Parse(decimalNumber, new
System.Globalization.CultureInfo("de-de"));
After you have parsed the value correctly through the GUI it should be
stored correctly in your database.
Hope that helps
Mark R Dawson.
"Brenny" wrote:
Hello
I'm developing a project by using access database and there is a
table(Table1) and it has a field(ml_mik) this is the decimal field.
I'm taking a value from windows form as a decimal variable(for example 12,3
or 12.3). After saving record, value(12,3 or 12.3) is saved as 123, not 12,3
or 12.3...
I'm using ADO.NET for processes in the database.
How can I accomplish this error? How can I save 12,3 value in the database?
Thanks for your helps.