LLBL:删除不在的地方
我正在尝试在 LLBL 中执行以下查询,但运气不佳。
DELETE FROM dbo.MyTable WHERE MyTableId NOT IN ('39', '43', '44')
本质上,我到目前为止:
private static void Delete(MyTableCollection newRecs)
{
PredicateExpression filter = new PredicateExpression();
MyTableCollection allRecords = new MyTableCollection();
filter.Add(new FieldCompareSetPredicate(
MyTableFields.MyTableId,
MyTableFields.MyTableId,
SetOperator.In, null, null, string.Empty, 0, null, true));
allRecords.DeleteMulti(filter);
}
我不确定上面的代码是否正确,但我不明白如何提供 newRecs 作为要在 IN 子句中使用的记录集合。 我还接近吗?
任何帮助将不胜感激。
注意:我意识到我在 SQL 示例中使用了静态 ID,但我确实尝试使用存储在 newRecs 参数中的 ID。
I'm trying to perform the following query in LLBL and I'm not having much luck.
DELETE FROM dbo.MyTable WHERE MyTableId NOT IN ('39', '43', '44')
Essentially, I'm up to this point:
private static void Delete(MyTableCollection newRecs)
{
PredicateExpression filter = new PredicateExpression();
MyTableCollection allRecords = new MyTableCollection();
filter.Add(new FieldCompareSetPredicate(
MyTableFields.MyTableId,
MyTableFields.MyTableId,
SetOperator.In, null, null, string.Empty, 0, null, true));
allRecords.DeleteMulti(filter);
}
I'm not sure if the above code is correct, but I'm not understanding how I can supply newRecs as the Collection of records to use in my IN clause. Am I even close?
Any help would be greatly appreciated.
NOTE: I realize that I used static ID's in my SQL example, but I'm really attempting to use the ID's that are stored in the newRecs parameter.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了让“不在”起作用,您必须传递某种数组。 尝试这样的事情:
In order to get the "not in" to work, you've got to pass some kind of array. Try something like this: