如何在 vb.net 中使用 Switch 语句访问数据库

How to use Switch statement to an access database in vb.net

我正在尝试 SELECT 2 个字段中的最高日期值作为变量,然后在 WHERE 中使用它 这是我的查询

SELECT Some_ID, Stuff_Name, Bla_number, Something_Else, SWITCH(Review_date > Revised_date, Review_date, Revised_date > Review_date, Revised_date) AS MaximumDate 
FROM DocList 
WHERE (MaximumDate >= CDATE('01/01/1990')) AND (MaximumDate <= CDATE('01/01/2011'))

我收到错误消息 No value given for an or more required parameters。

你又打错了,或者它不知道 MaximumDate 是什么:

SELECT 
   Some_ID, 
   Stuff_Name, 
   Bla_number, 
   Something_Else, 
   DateAdd("yyyy", 2, IIf(Review_date > Revised_date, Review_date, Revised_date)) AS MaximumDate 
FROM 
   DocList 
WHERE 
   IIf(Review_date > Revised_date, Review_date, Revised_date)
       Between #01/01/1990# AND #01/01/2011#