The expression contains unsupported operator 'Between'.
Instead of between opertor we can use the ' <= ' and ' >= '
Instead of between opertor we can use the ' <= ' and ' >= '
DataView dview_certificates = table.DefaultView;
if (Session["StartDate"] != null && Session["EndDate"] != null)
{
//strRowfilter = "(StartDate between '" + DateTime.Parse(Session["StartDate"].ToString()).ToShortDateString();
//strRowfilter += "' and '" + DateTime.Parse(Session["EndDate"].ToString()).ToShortDateString();
//strRowfilter += "') or (FinishDate between '" + DateTime.Parse(Session["StartDate"].ToString()).ToShortDateString();
//strRowfilter += "' and '" + DateTime.Parse(Session["EndDate"].ToString()).ToShortDateString() + "')";
strRowfilter = "(StartDate >= '" + DateTime.Parse(Session["StartDate"].ToString()).ToShort
DateString();
strRowfilter += "' and StartDate <='" + DateTime.Parse(Session["EndDate"].ToString()).ToShort
DateString();
strRowfilter += "') or (FinishDate >= '" + DateTime.Parse(Session["StartDate"].ToString()).
ToShortDateString();
strRowfilter += "' and FinishDate <= '" + DateTime.Parse(Session["EndDate"].ToString()).
ToShortDateString() + "')";
dview_certificates.RowFilter = strRowfilter;
{
//strRowfilter = "(StartDate between '" + DateTime.Parse(Session["StartDate"].ToString()).ToShortDateString();
//strRowfilter += "' and '" + DateTime.Parse(Session["EndDate"].ToString()).ToShortDateString();
//strRowfilter += "') or (FinishDate between '" + DateTime.Parse(Session["StartDate"].ToString()).ToShortDateString();
//strRowfilter += "' and '" + DateTime.Parse(Session["EndDate"].ToString()).ToShortDateString() + "')";
strRowfilter = "(StartDate >= '" + DateTime.Parse(Session["StartDate"].ToString()).ToShort
DateString();
strRowfilter += "' and StartDate <='" + DateTime.Parse(Session["EndDate"].ToString()).ToShort
DateString();
strRowfilter += "') or (FinishDate >= '" + DateTime.Parse(Session["StartDate"].ToString()).
ToShortDateString();
strRowfilter += "' and FinishDate <= '" + DateTime.Parse(Session["EndDate"].ToString()).
ToShortDateString() + "')";
dview_certificates.RowFilter = strRowfilter;
}
Thank You Raghavendhar Reddy Sir...
ReplyDeleteIts help me...
Thank You So Much...