Hi
I need to cconvert object datatype to long.
I am using the switch statement like this.
Switch(
DownloadTourMaster.CalculateExpectedDuration=0,
0,
DownloadTourMaster.CalculateExpectedDuration > 0,
DownloadTourMaster.TourCount + DownloadTourMaster.MissedCount
)
In above code DownloadTourMaster.CalculateExpectedDuration is the object datatype. Its showing error as runtime that can't assign object or int to > operator.
Please suggest me. Its very urgent.
Thanks
Vikas
object to long datatype converion
object to long datatype converion
Hello,
You make incorrect comparison of DateTime и Long.
If you wish to compare the field of the DateTime type, then you need to either compare with some default value
(for example 01.01.1900:
or to calculate the amount in days (hours, minutes) and compare with it (Long and Long).
Thank you.
You make incorrect comparison of DateTime и Long.
If you wish to compare the field of the DateTime type, then you need to either compare with some default value
(for example 01.01.1900:
Code: Select all
Switch( DownloadTourMaster.CalculateExpectedDuration==DateTime.Parse("01.01.1900"), 0,
DownloadTourMaster.CalculateExpectedDuration >DateTime.Parse("01.01.1900"), DownloadTourMaster.TourCount + DownloadTourMaster.MissedCount))
Thank you.
object to long datatype converion
Hello,
You cannot compare different types (in your case the object and long types) This is one of the requirements of the .NET (severe data typification).
You must use the reduction of types.
You may use the following expression:
Switch((long)DownloadTourMaster.CalculateExpectedDuration==0,0,
(long)DownloadTourMaster.CalculateExpectedDuration > 0, DownloadTourMaster.TourCount + DownloadTourMaster.MissedCount)
Thank you.
You cannot compare different types (in your case the object and long types) This is one of the requirements of the .NET (severe data typification).
You must use the reduction of types.
You may use the following expression:
Switch((long)DownloadTourMaster.CalculateExpectedDuration==0,0,
(long)DownloadTourMaster.CalculateExpectedDuration > 0, DownloadTourMaster.TourCount + DownloadTourMaster.MissedCount)
Thank you.
object to long datatype converion
Hello Aleksey,
I found the solution. Thanks a lot.
Thanks
Vikas
I found the solution. Thanks a lot.
Thanks
Vikas
object to long datatype converion
Ok! Thank you.