mysql:q.Add(new Condition("Datepart(yy,E_BeginDate)", txtyear)); 年相等q.Add(new Condition("Datepart(m,E_BeginDate)", txtmonth)); 月相等时间比较:if (DateTime.Compare(startDate,endDate)>0){ .......}