先谢过大家了。 to xiays(一叶小舟): 问题就是记录不下来啊,请赐教 to myhex(小乙) : 在未进行acceptchanges之前是不会真正删除该行的,其实我是想记录下该行的行号,一旦我想取消删除,直接使用rows[行号].RejectChanges来操作。我不希望用DataTable.RejectChanges来取消,这样会取消我的所有操作 to redlion963(狮子) : 你是说find方法吗,还是select 方法,似乎不太好用。请给点例子
DataTable myTable; myTable = DataSet1.Tables["Orders"]; // Presuming the DataTable has a column named Date. string strExpr; strExpr = "Date > '1/1/00'"; DataRow[] foundRows; // Use the Select method to find all rows matching the filter. foundRows = myTable.Select(strExpr); // Print column 0 of each returned row. for(int i = 0; i < foundRows.Length; i ++){ Console.WriteLine(foundRows[i][0]); }看看文档,很好用
to xiays(一叶小舟):
问题就是记录不下来啊,请赐教
to myhex(小乙) :
在未进行acceptchanges之前是不会真正删除该行的,其实我是想记录下该行的行号,一旦我想取消删除,直接使用rows[行号].RejectChanges来操作。我不希望用DataTable.RejectChanges来取消,这样会取消我的所有操作
to redlion963(狮子) :
你是说find方法吗,还是select 方法,似乎不太好用。请给点例子
myTable = DataSet1.Tables["Orders"];
// Presuming the DataTable has a column named Date.
string strExpr;
strExpr = "Date > '1/1/00'";
DataRow[] foundRows;
// Use the Select method to find all rows matching the filter.
foundRows = myTable.Select(strExpr);
// Print column 0 of each returned row.
for(int i = 0; i < foundRows.Length; i ++){
Console.WriteLine(foundRows[i][0]);
}看看文档,很好用