-1

I keepo getting this compile error:

Cannot implicitly convert type 'int' to 'SVSFinAP.Databases.FMSExpenseCode'

where SVSFinAP.Databases.FMSExpenseCode is defined as int?

This is my code:

ol.FMSExpenseCode = (int)rowOrderLine.OrderLineExpenseCodeID;
dcastro
  • 66,540
  • 21
  • 145
  • 155
Steve Staple
  • 2,983
  • 9
  • 38
  • 73

4 Answers4

2

'SVSFinAP.Databases.FMSExpenseCode' <-- is not an integer which means you need to convert to 'SVSFinAP.Databases.FMSExpenseCode' type

1

are you sure the ol.FMSExpenseCode is an int? The exception message says it is an SVSFinAP.Databases.FMSExpenseCode type.

Check the type of you are working like ol.FMSExpenseCode, rowOrderLine.OrderLineExpenseCodeID and cast to the right type. It is not an integer.

Felipe Oriani
  • 37,948
  • 19
  • 131
  • 194
0

Perhaps you need to cast, assuming it's an enum?

ol.FMSExpenseCode = (FMSExpenseCode)rowOrderLine.OrderLineExpenseCodeID;
Dave Bish
  • 19,263
  • 7
  • 46
  • 63
-2
ol.FMSExpenseCode = Convert.ToInt32(rowOrderLine.OrderLineExpenseCodeID);
Sefa
  • 8,865
  • 10
  • 51
  • 82