I have a small proble while making program. I want to get maximum and minimum value of column say smarks of data table. How can I perform this task as it is prity simpple in sql query I just call max and min function. Is something like it present in ADO.NET.
You can use concept of Linq to solve your prtoblem.
Here I give you some code piece which might be solve your problem.
DataTable parentTable = ds.Tables;
List<int> values = parentTable.AsEnumerable().Select(age => age.Field<int>("sage")).Distinct().ToList();
string str = "Maximum Value : " + values.Max() + " : Minimum Value : " + values.Min();
You can do it by using compute method of DataTable.
DataTable dt = ds.Tables;
int min = dt.Compute("min(age)", string.Empty);
int max = dt.Compute(max(age)", string.Empty);
Hope this will solve your problem.