Stop Implicit Typecast
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.
精彩评论