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);
。。。