C# Data table filtering

Question posted in Computer Software on 06 2010
Rate question difficulty level 1 Votes
given a data table named "dt" which of the following can be used to filter it?

A. dt.Find( t => t.field = "value");
B. dt.filter(fieldName,value);
C. dt.Select("field=" + value);
 
 
4 Answers
 
The right answer is C

06/09/2010
 
 
C is the answer:
DataTable.Select Method (String)

is the method of the DataTable Class that filters.

The expression has its own syntax for specifiying the selection criteria:

http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx

06/10/2010
 
 
its C
strExpression="Country =" + oTxtCountry.Text;
strSort=" ORDER BY CITY DESC";
dt.Select(strExpression,strSort)

06/13/2010
 
 
couldn't you just say dt.FilterExpression = "WHERE ColumnName = "someFilterValue";
???

06/17/2010
 
 
Add an answer*
 
Your name
Email
 
Company: iForex
Location: Israel
C# DataTable

add a question

arrow_blue


Now hiring!
---------------------------
---------------------------
---------------------------
---------------------------
Mercer 
---------------------------
---------------------------
---------------------------