需要查询某用户某天的总次数,程序如下
userid="435881"
d1=CStr(Date())
Set rs1=myconn.execute("execute getTodayDownloadTimes "&userid&","&d1)
存储过程如下
CREATE PROCEDURE getTodayDownloadTimes
@userId int,
@ChkDate char
AS
select count(*) as TodayDownloadTimes from [download] where userid=@userId and ChkDate=@ChkDate
GO
一直提示
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e14' [Microsoft][ODBC SQL Server Driver][SQL Server]第 1 行: '-' 附近有语法错误。 我把参数 d1 去掉就没问题了,难道查询参数里不能出现 - 这个符号?那如2007-8-1这样的时间如何查找
userid="435881"
d1=CStr(Date())
Set rs1=myconn.execute("execute getTodayDownloadTimes "&userid&","&d1)
存储过程如下
CREATE PROCEDURE getTodayDownloadTimes
@userId int,
@ChkDate char
AS
select count(*) as TodayDownloadTimes from [download] where userid=@userId and ChkDate=@ChkDate
GO
一直提示
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e14' [Microsoft][ODBC SQL Server Driver][SQL Server]第 1 行: '-' 附近有语法错误。 我把参数 d1 去掉就没问题了,难道查询参数里不能出现 - 这个符号?那如2007-8-1这样的时间如何查找
--这样试一下 因为 d1 --- @ChkDate char 是字符型
Set rs1=myconn.execute("execute getTodayDownloadTimes "&userid&",'"&d1&"'")
d1=CStr(Date())
Set rs1=myconn.execute("execute getTodayDownloadTimes "&userid&",'"&d1&"'")