我收到「我的DataView rowfilter屬性中出現」在System.Data.dll中發生類型'System.StackOverflowException'的未處理異常「。我沒有得到任何堆棧跟蹤。 所以任何人都可以幫助我。請在下面的代碼中找到filterView中的錯誤。DataView行篩選器中的stackoverflow異常
DataSet metalAttributeDS = LoadItemData(); //loads the static dataset
DataTable metalDataTable = metalAttributeDS.Tables["FilterTable"];
DataView metalfilterView = new DataView(metalDataTable);
metalfilterView.ApplyDefaultSort = true;
metalfilterView.RowFilter = queryBuilder +
string.Format(
" And AttributeName='Metal' and AttributeValueID in ({0})",
string.Join(",", AttributeValueID.ToArray())); //forms query condition dynamically.
var res = from DataRowView rowView in metalfilterView select rowView["ItemID"].ToString();
int countParam = 0;
queryBuilder.AppendFormat(" and (");
foreach (string id in res)
{
countParam++;
queryBuilder.AppendFormat(" ItemID = '{0}'", id);
if (res.Count() > countParam)
{
queryBuilder.Append(" Or");
}
}
queryBuilder.Append(")");
}
DataSet dataSet = LoadItemData(); //loads the static dataset
DataTable dataTable = dataSet.Tables["FilterTable"];
DataView filterView = new DataView(dataTable);
filterView.ApplyDefaultSort = true;
LogHelper.LogInfo(GetType(), "filterView.RowFilter");
filterView.RowFilter = queryBuilder.ToString(); // throws error
謝謝, Mehul Makwana。
也就是說問題的所在。我認爲,過濾器試圖比較字符串id Guid id和獲取錯誤。 – 2010-09-13 14:59:15
堆棧溢出異常不是因爲這個。我已經改變了我的代碼與什麼aristos建議,所以給我錯誤,我不能執行=操作System.Guid。 – mehul9595 2010-09-13 15:15:07