You need to sign in to do that
Don't have an account?

Error
Hi
While searching for date I am getting this error
no viable alternative at character ' '
the code is
if (StartDate != null) soql += ' and Start_Date__c equals ' + myDate ;
please help me
thanks
anuraj
Does this work?
Are you getting the error when performing the query or when compiling the code?
If you're getting it when performing the query, could you please do a Sytemd.debug of the query string and post that?
No it is not working.
Hi spraetz
the debug log is
this is my code
please help me
thanks
Anuraj
Your approach doesn't seem to work with calls to Database.Query().
I suspect it is because the date gets converted to a string before being passed to the query method of database.
I get the same error.
But if I approach it in the following way:
I get a success.
From the looks of it, you are building the query string as you go so in order to convert it to the second approach would be messy but not impossible.
I think you need to simply surround your date with single quotes to make it a string.
Ryan,
Your suggestion was attempted earlier but I tried it once again and found this error, confirming my previous assessment.
Doesn't seem like you can use a string when comparing against a Date or DateTime fields.
Try this simple annonymous code do demonstrate the above error: