LINQ Help

  • Thread starter Thread starter rajkiranpro
  • Start date Start date
R

rajkiranpro

I have a datatable being returned by a webservice.

I want to query the datatable using linq..

like select status from datatable where jobname='job1'

Can anypne say how?


Thanks

Regards
Rajkiran
 
rajkiranpro said:
I have a datatable being returned by a webservice.

I want to query the datatable using linq..
like select status from datatable where jobname='job1'

var query =
from row in dataTableInstance.AsEnumerable()
where row.Field<string>("jobname") == "job1"
select row.Field<string>(status)

Adjust the type (e.g. string) of status to what your table has.
 
rajkiranpro said:
thank you for that.. how do I fetch the value from the query variable?

foreach (string status in query)
{
Console.WriteLine(status);
}
 
Back
Top