-2
我有一個數據表然後我想查詢表並過濾依賴多次的數據。我有以下查詢基於過濾器的查詢linq查詢
DataTable results = new DataTable();
//fill dt from sql query
var linqResult = from myRow in results.AsEnumerable()
select myRow;
if (!string.IsNullOrEmpty(txtFilterName.Text))
{
linqResult = linqResult.Where(r => linqResult.name.ToLower.Contains(txtFilterName.Text.ToLower()));
}
我不斷收到錯誤
'EnumerableRowCollection<DataRow>' does not contain a definition for 'name' and no extension method 'name' accepting a first argument of type 'EnumerableRowCollection<DataRow>'
Where name refers to the field name in the datatable
誰能告訴我什麼,我做錯了
什麼是'補dt'?在你的代碼中是否有一些評論?這個'load'變量是什麼? 'load'變量沒有在你的代碼片段中聲明。 – RBT
剛更新了我的帖子 –