This question is locked. New answers and comments are not allowed.
Hello,
I am trying to filter a table containing a date column. I prefer to build linq Expression dynamically. So I am using ;
But I have an error with only date parameters. The error message is:
Operator '=' incompatible with operand types 'DateTime' and 'String'
How should I add the date parameter to my query ?
Thank you.
Inanc
I am trying to filter a table containing a date column. I prefer to build linq Expression dynamically. So I am using ;
string LinqExpression = string.Empty;
Guid userId = MonoSoftware.MonoX.Utilities.SecurityUtility.GetUserId();
int BolgeKodu = client.BolgeKoduDon(userId);
//string UsrName = User.Identity.ToString();
LinqExpression += "BOLGEKODU=" + BolgeKodu.ToString();
if (FirmaSecControl.FirmaId != 0)
{
LinqExpression += " && FIRMAID=" + FirmaSecControl.FirmaId;
}
if (txtTeklifNo.Text.Trim() != String.Empty)
{
LinqExpression += " && TEKLIFNO=\"" + txtTeklifNo.Text.Trim() + "\"";
}
if (raddtTeklifTar.SelectedDate != null)
{
LinqExpression += " && TEKLIFTAR=\"" + raddtTeklifTar.SelectedDate.ToString().Replace(" 00:00:00","")+ "\"";
//LinqExpression += " && TEKLIFTAR=" + raddtTeklifTar.SelectedDate.ToString().Replace(" 00:00:00", "") ;
//LinqExpression += " && TEKLIFTAR=" + raddtTeklifTar.SelectedDate;
}
if (LinqExpression.Substring(0, 3) == " &&")
{
LinqExpression = LinqExpression.Remove(0, 3);
}
But I have an error with only date parameters. The error message is:
Operator '=' incompatible with operand types 'DateTime' and 'String'
How should I add the date parameter to my query ?
Thank you.
Inanc