给个例子
 
private void DemonstrateDeleteRow(){
   // Create a simple DataTable with two columns and ten rows.
   DataTable myTable = new DataTable("myTable");
   DataColumn c1 = new DataColumn("id",Type.GetType("System.Int32"));
   c1.AutoIncrement=true;
   DataColumn c2 = new DataColumn("item", Type.GetType("System.String"));
   myTable.Columns.Add(c1);
   myTable.Columns.Add(c2);
   // Add ten rows.
   DataRow newRow;
        
   for(int i = 0; i <10; i++){
      newRow = myTable.NewRow();
      newRow["item"] = "Item " + i;
      myTable.Rows.Add(newRow);
   }
   myTable.AcceptChanges();
   // Create a DataView with the table.
   DataRowCollection rc = myTable.Rows;
   rc[0].Delete();
   rc[2].Delete();
   rc[3].Delete();
   rc[5].Delete();
   Console.WriteLine(rc[3].RowState.ToString());
   // Reject changes on one deletion.
   rc[3].RejectChanges();
   // Change the value of the column so it stands out.
   rc[3]["item"] = "Deleted, Undeleted, Edited";
   // Accept changes on others.
   myTable.AcceptChanges();
   // Print the remaining row values.
   foreach(DataRow r in myTable.Rows){
      Console.WriteLine(r[0] + "\t" + r[1]);
   }

解决方案 »

  1.   

    你可以使用DataView DataView dvtable=yourdataset.Tables["yourtable"];int i=dvtable.Find("你知道的值");//最好是主健或unique得到第几行后,就可以对他操作了
      

  2.   

    如果满足条件的不为一行DataRowView[] foundRows= dvtable.FindRows(new object("值"));
      

  3.   

    tlping(crazyboy)兄:感谢!快搞定了,
    如果需要两个字段的值才能找到需要的一行,该怎样作呢?
    "int i=dvtable.Find("你知道的值");//最好是主健或unique"
    难道是int i=dvtable.Find("你知道的值1",“值2”)?;
      

  4.   

    public int Find(object[]);
    试试行不行
      

  5.   

    wri(),lbx1979(Love Arsenal)说的是对的,Find()方法的重载版本,可以有多个参数,