我正在尝试使用LLBL Gen Pro查询数据库中的黑色空格。 有些在数据库中,值为空(不为空)。 有人能告诉我该怎么办?
我尝试了一些方法,但它们都没有正常工作。
filter.AddWithAnd(RecipeFields.FeaturedItem % ""); //way 1
filter.AddWithAnd(RecipeFields.FeaturedItem == String.empty); // way 2
filter.AddWithAnd(RecipeFields.FeaturedItem == System.DBNull.value); // way 3
答案 0 :(得分:1)
我还没有对它进行测试,但它应该有效:
var predicateBucket = new RelationPredicateBucket();
var trimedLengthPredicate = new EntityField("FeaturedItemEmptyLength",
new DbFunctionCall("LENGTH", new Object() { new DbFunctionCall("RTRIM", new Object() { new DbFunctionCall("LTRIM", new Object() { RecipeFields.FeaturedItem })})})) == 0;
var emptryTextPredicate = RecipeFields.FeaturedItem % "% %";
predicateBucket.PredicateExpression.Add(trimedLengthPredicate & emptryTextPredicate);
这是此查询的谓词:
SELECT * FROM RecipeFields r WHERE LENGTH(LTRIM(RTRIM(r.FeaturedItem))) = 0 AND r.FeaturedItem LIKE '% %';
警告:此谓词仅检查空格,而不检查TAB或输入字符。
了解更多信息:https://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=23385