1. 在没有主键的DataTable的查询用Select方法
声明:
public DataRow[] Select (string filterExpression, string sort)
用起来和sql的select语句有些相似
实例:
// Presuming the DataTable has a column named Date. string expression = "Date > '1/1/00'"; // Sort descending by column named CompanyName. string sortOrder = "CompanyName DESC"; DataRow[] foundRows; // Use the Select method to find all rows matching the filter. foundRows = table.Select(expression, sortOrder);
table.Select("ID = 0"); //table.Select("ID = {0}", text);
。。。