日期怎么不对?asp问题

来源:百度知道 编辑:UC知道 时间:2024/06/01 17:56:00
strdatefrom=cdate(year(date)&"-1-1")'每年第一天
strdateto=cdate(year(date)&"-12-31")'每年最后一天
strsqlcom="select SUM(PerformanceScore*difficulty) as score from workinfo where del=false and result<>'正在进行' and betwween strdatefrom and strdateto "
运行的时候说sql语句有问题,哪位帮下忙

晕!!
看了你上面的代码!发现你没有区分2中语言
ASP里面你用的VBscript
strdateto=cdate(year(date)&"-12-31")'每年最后一天
执行这句这后strdateto在ASP里面是日期格式,
但你在SQL语句里面也是日期格式吗??
请把2中语言类型分清楚
ASP执行SQL语句只是发送一段SQL字符串语句倒数据库去执行!
发送的语句是字符串类型的!

在SQL语句里面用 #2008-1-15# 这样 表示

还有你的变量怎么直接加倒SQL语句里面去了 ??那样会把变量当成字符串的

strsqlcom="select SUM(PerformanceScore*difficulty) as score from workinfo where del=false and result<>'正在进行' and betwween #"&strdatefrom&"# and #"&strdateto&"# "



数据类型你知道吗???
vbscript日期类型怎么表示??
sql里面日期类型又是怎么表示????
还有 字符串 和变量怎么连接???
这些你都知道吗???

数据类型不匹配的原因。year(date)&"-1-1" 之中year(date)是date类型的。而后面的-1-1 ,是int类型的吧。怎么的会可以的直接的进行运算的