You must check strings, not numbers, to insert single quotes in the query expr='string'
foreach (DataRow drInner in dtLogic.Select("ParentId='" + Convert.ToInt64(drOuter["Id"]) + "'")) { }
after this edit you can replace as @Christos answer says
Convert.ToInt64(drOuter["Id"])
from
drOuter["Id"].ToString()
source share