V
Vyacheslav Lanovets
Hello, All!
I have a Column object with String DataType, so when it's assigned with
Double value it gets converted to String. Convertion uses default locale
which in my case has "," as NumberDecimalSeparator.
Assigning is perfomed by DataRowCollection.Add(object[])
I see two solutions:
- change current thread's Culture before calling Add() (I use this solution
now)
- change DataType of Column to double, so WriteXml of Dataset will write it
with neutral culture
Are there any other solutions? Somehow substitute neutral culture for
convertion?
My code:
------------
DataSet cnv_ds = new DataSet();
cnv_ds.ReadXmlSchema(m_convert_schema); // so all Columns are Strings
cnv_ds.Tables.Add("Converted");
foreach (DataRow row in xls_ds.Tables[0].Rows)
{
object[] ins_row = ConvertRow(row.ItemArray);
cnv_ds.Tables[0].Rows.Add(ins_row); // here I get 92,5 instead of 92.5
}
I have a Column object with String DataType, so when it's assigned with
Double value it gets converted to String. Convertion uses default locale
which in my case has "," as NumberDecimalSeparator.
Assigning is perfomed by DataRowCollection.Add(object[])
I see two solutions:
- change current thread's Culture before calling Add() (I use this solution
now)
- change DataType of Column to double, so WriteXml of Dataset will write it
with neutral culture
Are there any other solutions? Somehow substitute neutral culture for
convertion?
My code:
------------
DataSet cnv_ds = new DataSet();
cnv_ds.ReadXmlSchema(m_convert_schema); // so all Columns are Strings
cnv_ds.Tables.Add("Converted");
foreach (DataRow row in xls_ds.Tables[0].Rows)
{
object[] ins_row = ConvertRow(row.ItemArray);
cnv_ds.Tables[0].Rows.Add(ins_row); // here I get 92,5 instead of 92.5
}