I'm not sure if the weather is possible or not, but I have to somehow do it in my project. I get one condition in string format, for example:
string condition = "(param1='69' OR param1='66' OR param1='21' OR param1='93') AND (param2='FL' OR param2='WA) AND (param3!='31' AND param3!='19')";
This is the condition I get from db, and I have the value param1, param2 and param3 in my code. Now I have to check this condition in the if statement so that its true value is false and show the result accordingly.
I am trying how to replace param1, param2, param3 with the actual value, say 69, CA, 22. So the line will look like this:
condition = "(69='69' OR 69='66' OR 69='21' OR 69='93') AND (CA='FL' OR CA='WA) AND (22!='31' AND 22!='19')";
and try converting it to bool, but it does not work.
Please let me know if there is any way, or do I need to hard record it? One more thing: a condition can be very strong, for example, sometimes it will have 2 variables, and sometimes four.
source share