Selecting from datatable
-
I want to select "FullName","EmployeeNumber" from the datatable 'results' ..The selection should be based on some conditions like date=some date....Can anybody tell how to achieve this???
-
I want to select "FullName","EmployeeNumber" from the datatable 'results' ..The selection should be based on some conditions like date=some date....Can anybody tell how to achieve this???
Datatable has a method Select which does what it says but I am not sure whether it allows filtering or not. If I remember correctly you can use DataView to filter data.
Giorgi Dalakishvili #region signature My Articles Asynchronous Registry Notification Using Strongly-typed WMI Classes in .NET [^] My blog #endregion
-
I want to select "FullName","EmployeeNumber" from the datatable 'results' ..The selection should be based on some conditions like date=some date....Can anybody tell how to achieve this???
If you are using .Net 3.0 or above, LINQ is your friend. Otherwise, you can use DataTable.Select method to get the rows which fulfill the conditions and then extract the name and employee numbers from them. If this is a one time activity ie conditions are pre defined and well known, the fetch only the data that confirms the conditions. You can have a stored procedure which can take the date values as parameter and then return the records.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
-
I want to select "FullName","EmployeeNumber" from the datatable 'results' ..The selection should be based on some conditions like date=some date....Can anybody tell how to achieve this???
Try objTable.Select("date='some date'");
Anurag Gandhi. http://www.gandhisoft.com Life is a computer program and every one is the programmer of his own life.