[Solved] What is the equivalent code of SQL query in C# with linq to datatable?


I used this Code and it Worked for me.

DataRow row = dt.AsEnumerable().FirstOrDefault
            (r => (DateTime)r["date"] == timeToCompare.Date
            & r.Field<string>("plannum") == "0995" &
            tp >= r.Field<TimeSpan>("MorningStart") &
            tp < r.Field<TimeSpan>("MorningEnd"));

And then using this to get values :

sh_starttime = row["MorningStart"].ToString();

solved What is the equivalent code of SQL query in C# with linq to datatable?