Unable to cast object of type 'System.Dezimal' zum Typ 'System.String'

Ich schrieb diesen code zu finden, welche von dtExistCosts bedeutet,y Ausfahrt in costsList.

var costMustbeDeleteDt = (
        from e in dtExistCosts.AsEnumerable()
        where !(from c in costsList 
                select Convert.ToString(c.CostRecordId))
                            .Contains(e.Field<string>("DETAIL_HAZ_PK"))
        select e).CopyToDataTable();

aber wenn ich es laufen lasse bekomme ich die Fehlermeldung:

Unable to cast object of type System.Decimal zu geben System.String

in

!(from c in costsList 
  select Convert.ToString(c.CostRecordId))
        .Contains(e.Field<string>("DETAIL_HAZ_PK"))

warum?

Welche Art ist DETAIL_HAZ_PK?
Es ist der name der Spalte, die ich überprüfen möchten.
Toll, und was type ist es?

InformationsquelleAutor user3702192 | 2015-03-09

Schreibe einen Kommentar