0
有人可以用下面的代碼來幫忙!Dataview Filteration問題
if (DiaryOccasions != null && DiaryOccasions.Rows.Count > 0)
{
DataTable dtFilteredOccasions = new DataTable();
if (ddlMonths.SelectedItem.Value != string.Empty)
{
string[] selMonthYear = ddlMonths.SelectedItem.Value.Split('/');
if(selMonthYear.Length > 0)
{
dtFilteredOccasions = new DataView(DiaryOccasions,
string.Format("MONTH(OccasionDate) = {0} AND YEAR(OccasionDate) = {1}",
selMonthYear[0].ToString(), selMonthYear[1].ToString()),
string.Empty, DataViewRowState.CurrentRows).ToTable();
}
}
rptrDates.DataSource = dtFilteredOccasions;
rptrDates.DataBind();
}
當嘗試了在運行時會引發下面的錯誤:
該表達式包含未定義的函數調用個月()。
請幫忙!!