New to linq and trying to acheive
select * from tblCountries order by CountryName
I followed the procedre in
http://msdn.microsoft.com/en-us/library/bb669096%28v=vs.110%29.aspx , and can now access the CopyToDataTable method.
But now there is a syntax error at the orderby part-
cannot convert IOrderedQueryable<Context.tblCountry> to Ienumerable<system.data.datarow> public DataTable GetAllRecords(bool bDeleted)
{
IEnumerable<DataRow> query = (from p in MedianDB.tblCountries
select p).OrderBy(p => p.CountryName);//error here
DataTable dt = query.CopyToDataTable<DataRow>();
if (dt != null)
return dt;
else
return dt;
}
I'm using C# and .net framework 4.0.Thank you.