I have a Datatable like this.Now how can i pick the value from zones based on weight and zone.I am doing this in c#
Asked
Active
Viewed 70 times
-2
-
3You have "a database like this"? It looks like a grid. Please specify the question. – Tarec May 14 '14 at 09:33
-
It is a Data table in C# – sindhu jampani May 14 '14 at 09:35
-
try this: http://stackoverflow.com/a/20148661/2416958 – Stefan May 14 '14 at 09:36
-
Its a screenshot of a datatable in preview mode in vs. Tarec. Completely plausable question – Jonny May 14 '14 at 09:39
2 Answers
1
Using LINQ Query : You need to use the AsEnumerable() extension for DataTable
var results = from myRow in myDataTable.AsEnumerable()
where myRow.Field<int>("RowNo") == 1
select myRow;
AsEnumerable() returns IEnumerable. If you need to convert IEnumerable to a DataTable, use the CopyToDataTable()
Check Here

Community
- 1
- 1

Ramy M. Mousa
- 5,727
- 3
- 34
- 45