将列转换为日期时间格式时不支持 Cast 和 Convert 函数(在 vbscript - Excel adodb 中)
Cast and Convert functions are not supported on converting the column to date time format (in vbscript - Excel adodb)
我已经编写了一个 vbscript 来使用 ADODB 连接将 excel 文件 (.xlsx) 作为数据库连接。我想从 excel 文件中提取记录,该文件在 'StartDate' 列中的值大于“15/05/2015”,但是在执行 adodb 查询时会抛出一个错误 "Data type mismatch in criteria expression."
我尝试使用 'Convert' 和 'Cast' 函数将 'StartDate' 列转换为日期格式,但不支持。如何编写查询来检索记录?
excel 中 'StartDate' 列中的值看起来像 "21/05/2015 0:00" 并双击该字段它看起来像 "21/05/2015 12:00:00 AM"
我尝试过的查询(所有查询都抛出数据不匹配错误):
Select * from [Student$] where StartDate >= '15/05/2015'
Select * from [Student$] where StartDate >= '15/05/2015 12:00:00 AM'
Select * from [Student$] where StartDate >= '15/05/2015 00:00:00.000'
Select * from [Student$] where StartDate >= '15/05/2015 0:00'
date literals的标记是#
,所以使用
Select * from [Student$] where StartDate >= #15/5/2015#
比照。 here
我已经编写了一个 vbscript 来使用 ADODB 连接将 excel 文件 (.xlsx) 作为数据库连接。我想从 excel 文件中提取记录,该文件在 'StartDate' 列中的值大于“15/05/2015”,但是在执行 adodb 查询时会抛出一个错误 "Data type mismatch in criteria expression."
我尝试使用 'Convert' 和 'Cast' 函数将 'StartDate' 列转换为日期格式,但不支持。如何编写查询来检索记录?
excel 中 'StartDate' 列中的值看起来像 "21/05/2015 0:00" 并双击该字段它看起来像 "21/05/2015 12:00:00 AM"
我尝试过的查询(所有查询都抛出数据不匹配错误):
Select * from [Student$] where StartDate >= '15/05/2015'
Select * from [Student$] where StartDate >= '15/05/2015 12:00:00 AM'
Select * from [Student$] where StartDate >= '15/05/2015 00:00:00.000'
Select * from [Student$] where StartDate >= '15/05/2015 0:00'
date literals的标记是#
,所以使用
Select * from [Student$] where StartDate >= #15/5/2015#
比照。 here