I have a DataTable in C# which I am returning from SQL server. I am passing this datatable to couple separate functions.
Can I send some sort of query directly to the DataTable, instead of looping over all records?
for example
set|subset|value
1 |1 |40
1 |2 |30
1 |3 |35
2 |1 |10
2 |2 |15
2 |3 |20
how can I do something like SELECT DISTINCT SET FROM TABLE
and get values 1
and 2
Just use LINQ, it's easier.
var result = yourTable.AsEnumerable().Select(f => f.Field<int>("Set")).Distinct();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With