Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
HI ,
I written below getting error can u please sujjest me, while take <> and order by functions i am getting the error


public DataTable getCountrys()
{
DataTable dtState = new DataTable();
dtState.Columns.Add("CountryName", typeof(String));
dtState.Columns.Add("CountryId", typeof(String));
dtState.AcceptChanges();
try
{
using (var entities = new edFusionRDSEntities())
{
DataRow[] _state = (from state in entities.Country.AsEnumerable()
let row=dtState.Rows.Add(
state.CountryName,
state.CountryId
)
select row).Distinct().OrderBy(d => d.Field<string>("CountryName")).Take(1).ToArray<datarow>();
if (_state.Length > 0)
_state.CopyToDataTable();
return dtState;
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
Posted
Comments
pradiprenushe 16-Aug-14 6:01am    
What error?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900