4

I am working with workflows in Sharepoint 2007. In the Workflow I am accessing a Inforpath form the Code Behind and add some Recurring values to a Sharepoint List.

string strProfitMargin = ProfitMargin;

decimal margin1 = decimal.Parse(strProfitMargin);

listItem["Test9"] = Math.Round(margin1, 2).ToString();

Suppose for the ProfitMargin I get a value "0.4230769230769231".

Decimal.Parse Method Returns 4230769230769231 without the Decimal point. Ultimately Math.Round also not working. This works perfectly in my machine. But in QA servers Its not Working. Please Help me and Explain why the decimal.Parse method not Working? Same Way for double.Parse() is returning a value without a decimal.

Thanks in Advance!

4

1 回答 1

7

我强烈怀疑您正在运行的机器具有不用.作小数点的文化。

明确指定区域性,例如固定区域性

decimal margin1 = decimal.Parse(strProfitMargin, CultureInfo.InvariantCulture);
于 2013-06-04T15:43:21.360 回答