同样的问题开了三个帖没解决
if atitle= "xwzw " then
ddrs.open "select a.*,b.* from vipgrzl a,vipqzyx b where b.xwzw like '% "&ClubId& "% ' and a.vipClubId=b.ClubId ",conn,1,1
elseif atitle= "no " then
ddrs.open "select * from vipgrzl where vipClubId like '[9]% ' ",conn,1,1
elseif atitle= "yes " then
ddrs.open "select * from vipgrzl where datediff(yyyy,cast(vipjssj as datetime),getdate())> 1 ",conn,1,1
else
sql= "select * from vipgrzl where "&atitle& " like '% "&ClubId& "% ' "
ddrs.open sql,conn,1,1
end if
其中 ddrs.open "select * from vipgrzl where datediff(yyyy,cast(vipjssj as datetime),getdate())> 1 ",conn,1,1
错误
Microsoft VBScript 编译器错误 错误 '800a03f6 '
缺少 'End '
/iisHelp/common/500-100.asp,行242
Microsoft OLE DB Provider for SQL Server 错误 '80040e07 '
从字符串转换为 datetime 时发生语法错误。
/glxt/seletchack.asp,行113
------解决方案--------------------UP
------解决方案--------------------Write出select * from vipgrzl where datediff(yyyy,cast(vipjssj as datetime),getdate())> 1
看看有没有错误先,然后放在SQL里运行看看
------解决方案--------------------错误原因写得很清楚。vipjssj 是不是能转换成 datetime ?
------解决方案--------------------字段vipjssj包含有无法转换为日期的数据,先要做一下处理,看看是哪些格式,可不可以调整。
------解决方案--------------------这三种格式应该都可以的,看看有没有null值?
------解决方案--------------------select * from vipgrzl where datediff(yyyy,cast(vipjssj as datetime),getdate())> 1
写成这样
select * from vipgrzl where vipjssj <dateadd(yyyy,-1,getdate())
试试