我有一个带有 2 列主索引的 5 列表。假设索引定义为 ( Col1
, Col2
)。
在以下代码段中,Api.TrySeek返回false,我不知道为什么:
Api.JetSetCurrentIndex(session, table, null);
// this should match on Col1 = colVal1 and Col2 = *
Api.MakeKey(session, table, colVal1, MakeKeyGrbit.NewKey | MakeKeyGrbit.FullColumnStartLimit);
if (Api.TrySeek(session, table, SeekGrbit.SeekEQ)) // why is this false??
{
Api.MakeKey(session, table, colVal1, MakeKeyGrbit.NewKey | MakeKeyGrbit.FullColumnEndLimit);
if (Api.TrySetIndexRange(session, table, SetIndexRangeGrbit.RangeUpperLimit | SetIndexRangeGrbit.RangeInclusive))
{
<loop through entries in index range>
但是,如果我使用SeekGrbit.SeekGE,它会返回true。有人可以解释为什么吗?不适用于通配符列,但可以吗?SeekEQ
SeekGE
在循环中,我仔细检查了所有条目是否都具有Col1 == colVal1
,以排除它只是在 where 找到条目的可能性Col1 > colVal1
。