Apr 07, 2012 09:58 PM|medivo|LINK
Can sombody please help me? I have datatble called DT with columns : kodId,kodO,RO,RD,Text and I need to select all Texts from rows with specific kodId and with with specific range between RO and RD. I have tried this query :
IEnumerable<string> results = from DataRow myRow in tempDT.Rows where myRow.Field<Int32>("kodId") == id && myRow.Field<Int32>("RO") <= Convert.ToInt32(rez) && myRow.Field<Int32>("RD") > Convert.ToInt32(rez) orderby myRow.Field<int>("kodO") select myRow.Field<string>("Text");
the variables have these values : id =1073754112 and rez="0"
and the datarow has these : kodId=1073754112, kodO=1, RO=0, RD=32767 Text ="<test/>"
but I am getting exception :Specified cast is not valid.
So maybe my syntax is bad, I don't know, because Linq is something new for me, so I woul be very happy if somebody has any advice