开发者

Stop Implicit Typecast

开发者 https://www.devze.com 2022-12-25 11:37 出处:网络
My issue is within AMO in a C# console application.I have a DataSourceView that has a table which has a column of type Decimal.

My issue is within AMO in a C# console application. I have a DataSourceView that has a table which has a column of type Decimal.

When I try to create a measure out of it, AMO says that it cannot create a measure because the data type is string.

I believe the开发者_StackOverflow社区re may be some implicit typecasting going on in the background that is causing this.

Is there an application wide setting to stop implict typecasting?


It sounds like you need to parse the string for the decimal -- decimal.Parse(s);

Of course you would want to make sure you handle the case where the string is not a decimal number.

Alternatively, you could use System.Convert


I think it depends on the implementation of DataSourceView being used.

DataSourceView takes a data source, but can do any sort of transformation on that data. The result of an ExecuteSelect() call is just an Enumerable -- there is no guarantee of what you get out in terms of type fidelity; it is entirely contingent upon the implementation.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号