使用ExecSQL过滤DateTime

问题描述 投票:0回答:1

我正在应用此过滤器:

var date = new DateTime(2019, 06, 20).ToUniversalTime().ToString("dd/MM/yyyy HH:mm");
MAPITable mt = session.Stores.MAPITable;
mt.Item = inbox.Items;

var records = mt.ExecSQL($"select Subject, EntryID from Inbox Where \"urn:schemas:httpmail:datereceived\" > {date}");

我有这个例外:

在ConsoleApplication1.exe中发生类型'System.Runtime.InteropServices.COMException'的未处理的异常

其他信息:不支持的运算符:/

应该可以进行这种过滤吗? [使用>运算符]

outlook-addin outlook-redemption
1个回答
1
投票

您需要确保日期变量是SQL格式的并且用单引号引起来。

© www.soinside.com 2019 - 2024. All rights reserved.