Hi,
I recommend you to use Linq, when you are using Entity Framework the data base contents will be available as Class Entity.
Where Linq help you a lot for optimized form of querying & Processing along with clean code.
You also get many helps in Linq when you struck up somewhere, so try Linq
The below sample for your scenario will works.
public class TempClass
{
public int SID { get; set; }
public string SNAME { get; set; }
public string SAGE { get; set; }
}
Public class Program
{
static void Main(string[] args)
{
List<tempclass> lstStudents = new List<tempclass>();
lstStudents.Add(new TempClass{SID= 101, SNAME = "Rajesh",SAGE ="25" });
lstStudents.Add(new TempClass{SID= 102, SNAME = "Anand",SAGE ="20" });
lstStudents.Add(new TempClass{SID= 103, SNAME = "Venky",SAGE ="21" });
lstStudents.Add(new TempClass{SID= 104, SNAME = "Prabhu",SAGE ="23" });
var data = from stud in lstStudents
where stud.SID > 101
select stud;
foreach (TempClass stud in data)
{
Console.WriteLine("SID : " + stud.SID + "\tSNAME : " + stud.SNAME + "\tSAGE : " + stud.SAGE);
}
}
</tempclass></tempclass>
Thanks!