>>>> string CRefeicao = "01", CFamiliaPrato = "02"; >>>> string strFilter = >>>> String.Format("CRefeicao = '{0}' and CFamiliaPrato = '{1}'", >>>> CRefeicao, >>>> CFamiliaPrato); >>>> foreach( DataRow row in Detalhe.Select( strFilter ) ) >>>> { >>>> row.Delete(); >>>> } >>>>>>>>Cetin
>using System; >using System.Data; >using System.Data.OleDb; > >class test >{ > static void Main() > { > OleDbConnection con = new OleDbConnection(@"Provider=VFPOLEDB; >Data Source=C:\PROGRAM FILES\MICROSOFT VISUAL FOXPRO 9\SAMPLES\data\testdata.dbc"); > con.Open(); > OleDbCommand cmd = > new OleDbCommand("select cust_id,company,contact,country from customer",con); > OleDbDataReader rdr = cmd.ExecuteReader(); > DataTable tbl = new DataTable(); > tbl.Load(rdr); > con.Close(); > > foreach(DataRow row in tbl.Rows) > { > if (((string)row["country"]).Trim() == "USA" || ((string)row["country"]).Trim() == "UK") > row.Delete(); > } > > for(int i=0;i<tbl.Rows.Count;i++) > { > if (tbl.Rows[i].RowState == DataRowState.Deleted ) > { > Console.WriteLine("Row:{0},{1}",i, > tbl.Rows[i].RowState); > } > else > { > Console.WriteLine("Row:{0},{1},{2}",i, > tbl.Rows[i]["cust_id"], > tbl.Rows[i]["country"]); > } > } > } >} >>
> foreach(DataRow row in tbl.Rows) > { > if (row.RowState == DataRowState.Deleted ) > { > Console.WriteLine("Row:{0}", row.RowState); > } > else > { > Console.WriteLine("Row:{0},{1}", > row["cust_id"], > row["country"]); > } > } >>I think what he did was to query row["field"] for deleted ones too.