ASP运行错误 PC_DATE 为DATE类型, 错误信息为:“Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]運算元類型衝突: date 與 int 不相容
/index.asp,行 69
” 错误语句为“ sql = "SELECT pc.pc_department,pc.pc_sort,pc.pc_time,pc.pc_time1,pc.pc_time,pc.pc_title,bg.pc_style FROM gspaicheng as pc, gssort_bg as bg where pc.pc_sort=bg.pc_sort and pc.pc_date="&dateAdd("d",2-weekday(date),date())&" ORDER BY pc_date" ”
有知道的兄弟速帮忙解决!
------解决方案-------------------- sql = "SELECT pc.pc_department,pc.pc_sort,pc.pc_time,pc.pc_time1,pc.pc_time,pc.pc_title,bg.pc_style FROM gspaicheng as pc, gssort_bg as bg where pc.pc_sort=bg.pc_sort and pc.pc_date="&dateAdd("d",2-weekday(date),date())&" ORDER BY pc_date" mssql不需要加引号
------解决方案-------------------- sql = "SELECT pc.pc_department,pc.pc_sort,pc.pc_time,pc.pc_time1,pc.pc_time,pc.pc_title,bg.pc_style FROM gspaicheng as pc, gssort_bg as bg where pc.pc_sort=bg.pc_sort and pc.pc_date = '" & dateAdd("d",2-weekday(date),date()) & "' ORDER BY pc_date"
sql = "SELECT pc.pc_department,pc.pc_sort,pc.pc_time,pc.pc_time1,pc.pc_time,pc.pc_title,bg.pc_style FROM gspaicheng as pc, gssort_bg as bg where pc.pc_sort=bg.pc_sort and DATEDIFF(d, pc.pc_date,getDate()) = " & (2-weekday(date)) & " ORDER BY pc_date"