今天开发时遇到一个问题,由于以前没有用到datatable.select(),很是头疼....在其中的表达式用的很简单的匹配,但是老是查不到数据,为什么呢??是其中有什么设置问题?

解决方案 »

  1.   

    在 datatable 获取数据后加个断点调试到哪里,自己在 watch 里面写  datatable.select("查询条件").length 自己看检索没检索出来数据没检索出来的话,自己找原因吧...  
      

  2.   

    看msdn:http://msdn.microsoft.com/en-us/library/det4aw50.aspx下面例子来自上的的网页: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]);
        }
    }
      

  3.   

    http://blog.csdn.net/maonongwu/article/details/6308922