views:

16

answers:

1

i have a table with these columns: errorCode (int) errorDesc (Varchar)

i'm trying to get the datarow where errorCode is 5:

  DataRow resultCodeRow = (from resultCodesTableRow in resultCodesDT.AsEnumerable()
                                 where resultCodesTableRow.Field<int>("result_Code_colum_Name") == 5
                                 select resultCodesTableRow).Single();

why do i get the error:

"Specified cast is not valid."

how would you write it ?

A: 

You need to change it to decimal

PK

Pavan
The OP said that errorCode is an int, not a varchar...
Thomas Levesque
ah right then its decimal then in that case. Ive made the right changes
Pavan