I am trying to evaluate an IF/Else expression (using .Net 2.0). The expression (sValidation) comes from the database, and will be used to validate the values entered into a form by the user. The following is a sample of sValidation:
If Form.Data.Field("Test Name").Value = "Testing one...two...three" Then
I tried using MSScriptControl, but have been unsuccessful. Using the EVAL(sValidation) I get a syntax error. If I put sValidation within a function (sCode), addCode(sCode) and use the RUN(sCode) then I get a "Class doesn't support Automation: 'Form.Data.Field'" error.
Form, Data, and Field are classes I built, and I think that's where it's getting hung up. I tried to addObject for the class, and I also tried to add the class code to sCode, but still no avail. (If I pass the actual value of "Form.Data.Field("Test Name").Value" as a parameter in sCode, then the expression is evaluated correctly - hence why I think it's the class...but I could be wrong)
Has anyone else had success evaluating this type of expression using classes?
Any suggestions of solving this, either with MSScriptControl or another method would be fantastic.