我需要從緩存的Dataview對象中選擇5個最近的行,有沒有辦法做到這一點?使用Dataview.RowFilter從SomeTable中選擇TOP 5 *?
我試過了,但是Indexer DataColumn是空的。 :
public static DataView getLatestFourActive()
{
DataTable productDataTable = getAll().ToTable();
DataColumn ExpressionColumn = new DataColumn("Indexer",typeof(System.Int32));
ExpressionColumn.Unique = true;
ExpressionColumn.AutoIncrement = true;
ExpressionColumn.AllowDBNull = false;
ExpressionColumn.AutoIncrementSeed = 0;
ExpressionColumn.AutoIncrementStep = 1;
productDataTable.Columns.Add(ExpressionColumn);
DataView productFilteredView = productDataTable.DefaultView;
productFilteredView.RowFilter = "isActive=1 and Indexer<4";
return productFilteredView;
}
GETALL()返回緩存數據視圖
感謝
做過這份工作,謝謝! – eugeneK 2010-04-13 09:50:01