HomeActive Query BuilderSetting Criteria In Code...

Setting Criteria In Code...


Hi all - when using the AQB GUI I can enter the 'Criteria' cell for a particular row and type enter the following text

= 'A' Or = 'B'

And then I can execute the query and it works great.

However, when I try to accomplish the same thing in code; I run into a problem. My code looks like this:

myCriteria.ConditionStrings(iConditionIndex) = sCondition

And sCondition is set to the exact same text used above, then I'm able to enter directly into single Criteria column (= 'A' Or = 'B')

But the value that gets saved in ConditionString(iConditionIndex) is the value of sCondition with single quotes around it ''. Well, it's actually
= ''A' Or = 'B''

And then the generated SQL will fail.

How can I set the condition string without having it add the single quotes?
Rob
October 8 2008, 04:35 PM
Following code works fine with the latest version:

UnionSubQuery usq = queryBuilder1.ActiveSubQuery.ActiveUnionSubquery;
usq.CriteriaList[0].ExpressionString = "'some expression'";
usq.CriteriaList[0].ConditionStrings[0] = "(='pattern1' or = 'pattern2')";
Eugene Starkov | email
1 day, 12 hours since original post
This topic is closed