有人可以帮忙用下面的代码吗!!
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();
}
尝试时会在运行时引发以下错误:
该表达式包含未定义的函数调用 MONTH()。
请帮忙 !!