public static int Getindex(string row,DataTable dt)
{
int id=0;
string rowvalue = row;
try
{
id = (from DataRow dr in dt.Rows
where (string)dr["Description"] == rowvalue
select (int)dr["Id"]).FirstOrDefault();
}
catch(Exception ex)
{
}
return id;
}
this linq query might solve your problem,
hope this helps,
--G--