DataTable的應用

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

 

。。。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章