BOOL Restrict(BSTR pwszRestriction)
pwszRestriction 
[in] Pointer to a null-terminated Unicode string that defines which items to include in the new collection. This must contain a Boolean expression that evaluates to TRUE or FALSE for any item. Enclose property names between brackets. You can combine with AND and OR. Comparison operators are the following: <, <=, >, >=, = or <>. 
For example, the restriction string [CompanyName] = "Microsoft" returns a collection of items with Microsoft as the company. ************************************************************************
when use like this:
Restrict(TEXT("[Company] = \"Microsoft\""));
IT WORKS WELL
************************************************************************
when use like this
Restrict(TEXT("[Start] > 37979"));
IT FAILED!
[Start] has DATE type我应该怎么写呢?

解决方案 »

  1.   

    Restrict(TEXT("[Company] = \"Microsoft\""));
    这样会对吗?两个都是错的吧?
    TEXT("[Start] > 37979")与TEXT("[Start] > 37979")类型是一样的,
    但都不对,都不是BSTR型的.
      

  2.   

    BSTR == WCHAR *WCHAR * == TEXT(" ... ")why wrong?
      

  3.   

    日期的子符表达方式和数据库引擎有关,不过你总是可以使用带参数的查询来绕过这个问题
    在Microsoft Access中,日期的子符表达方式是 #2002-12-30 14:19:56#这样的,当然省略日期或者时间部分也是可以的,例如#2002-12-30#和#14:19:56#