Play Games

Search This Blog

Friday, August 31, 2018

Error: Compile Error: Comparison arguments must be compatible types: Datetime, String

This error generally arise when you are comparing datetime field value to string.
Example
DateTime dt = system.now();
if(dt != null && dt !='') { // This line gives error as '' is a string
}

Solution : Just remove the condition dt != '' .
DateTime dt = system.now();
if(dt != null) { // This line checks if datetime field is not null.

}

No comments:

Post a Comment