DataTable.Select("(select count(*) from 表A)<number")number 屬于DataTable中的列名DataTable.Select()可以這么用嗎??
2 回答

一只斗牛犬
TA貢獻1784條經驗 獲得超2個贊
(DataTable的Select方法的filterExpression參數只是簡單的邏輯運算,達不到常規的sql語句的功能。
參考例子如下:
private void GetRowsByFilter()
{
DataTable table = DataSet1.Tables["Orders"];
// Presuming the DataTable has a column named Date.
string expression;
expression = "Date > '1/1/00'";
DataRow[] foundRows;
// Use the Select method to find all rows matching the filter.
foundRows = table.Select(expression);
// Print column 0 of each returned row.
for(int i = 0; i < foundRows.Length; i ++)
{
Console.WriteLine(foundRows[i][0]);
}
}

不負相思意
TA貢獻1777條經驗 獲得超10個贊
filterExpression 過濾表達式。 不用那么寫,直接寫某一各列的 值符合的條件。。
例如 列名位 num 值位整數的話 DataTable.Select(“num>=7") 就行。
- 2 回答
- 0 關注
- 325 瀏覽
添加回答
舉報
0/150
提交
取消