C#中用DataView.RowFilter对DataSet 中的数据进行过滤.

以Access为例               

OleDbDataAdapter daDK = new OleDbDataAdapter(strSql, cn);
                DataSet  daDK.Fill(ds, "TableName");
                DataView myDV = new DataView(ds.Tables["TableName"]);
                myDV.RowFilter = "DKTime = #" + aryDK[3].ToString() + "#";
                //如果没有重复记录
                if (myDV.Count == 0)
                { 

            while(myDV[i] != null)

             {//遍历}

                }

myDV[i]为过滤后的结果;

myDV.Table仍保存原来的整体数据.

你可能感兴趣的:(C#,null,Access,dataset)