LLBLGenPro:查询空白 space
LLBLGenPro: Query a blank space
我正在尝试使用 LLBL Gen Pro 查询数据库中的空白。
某些在数据库中,该值为空白(不为空)。
有人可以告诉我该怎么做吗?
我已经尝试了几种方法,但是 none 中的方法都可以正常工作。
filter.AddWithAnd(RecipeFields.FeaturedItem % ""); //way 1
filter.AddWithAnd(RecipeFields.FeaturedItem == String.empty); // way 2
filter.AddWithAnd(RecipeFields.FeaturedItem == System.DBNull.value); // way 3
我还没有测试过,但应该可以:
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 '% %';
警告:此谓词仅检查 space,不检查 TAB 或 Enter 字符。
更多信息:https://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=23385
我正在尝试使用 LLBL Gen Pro 查询数据库中的空白。 某些在数据库中,该值为空白(不为空)。 有人可以告诉我该怎么做吗?
我已经尝试了几种方法,但是 none 中的方法都可以正常工作。
filter.AddWithAnd(RecipeFields.FeaturedItem % ""); //way 1
filter.AddWithAnd(RecipeFields.FeaturedItem == String.empty); // way 2
filter.AddWithAnd(RecipeFields.FeaturedItem == System.DBNull.value); // way 3
我还没有测试过,但应该可以:
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 '% %';
警告:此谓词仅检查 space,不检查 TAB 或 Enter 字符。
更多信息:https://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=23385