Please assist in resoliving the following error. I spend a lot of time but could not. Thanks
Actually i marked line 777 which produces error. If i take off "authorized = 'N' and canvassType = 'M'", then no error.
Error
--------
Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E14)
Line 1: Incorrect syntax near '='.
/mySite/allPages/test5.asp, line 19
ASP Code
--------------
Const adCmdStoredProc = &H0004
Const adInteger = 3
Const adVarChar = 200
Const adChar = 129
Const adParamOutput = &H0002
Const adParamInput = &H0001
Set cmd = Server.CreateObject ("ADODB.Command")
cmd.ActiveConnection = Con
cmd.CommandText = "LateResponses"
cmd.CommandType = adCmdStoredProc
cmd.Parameters.Append cmd.CreateParameter ("@TableName",adChar,adParamInput,3,"Z30")
cmd.Parameters.Append cmd.CreateParameter ("@Number",adInteger,adParamOutput)
cmd.Parameters.Append cmd.CreateParameter ("@List",adVarChar,adParamOutput,500)
Set rs = cmd.Execute
intCount = cmd.Parameters("@Number")
intList = cmd.Parameters("@List")
Response.Write(intCount&" : "&intList)
SQL Code/Stored Procedure
------------------------------------
CREATE Proc LateResponses(@stableName char(3),@idCount int output,@idList varchar(500) output)
As
Declare @repPeriod char(2)
Declare @repYear char(4)
Declare @repId varchar(11)
Declare @repIds varchar(500)
Declare @recCount int
Declare @sql varchar(100)
Set @repIds = ''
Set @recCount = 0
-- Line 777
SELECT @sql = 'Declare MyCursor Cursor For Select reportPeriod,reportYear,reportid FROM ' + @stableName + '_tbl where authorized = ''N'' and canvassType = ''M'' '
EXEC(@sql)
--Select reportPeriod,reportYear,reportid from MyTable where authorized = 'N' and canvassType = 'M'
Open MyCursor
Fetch Next from MyCursor into @repPeriod,@repYear,@repId
While @@Fetch_Status = 0
Begin
if DateDiff(dd, Cast(@repPeriod+'/28/'+@repYear as DateTime), getDate()) >= 60
set @recCount = @recCount + 1
set @repIds = @repIds + @repId + ','
Fetch Next from MyCursor into @repPeriod,@repYear,@repId
End
Set @idCount = @recCount
Set @idList = @repIds
Close MyCursor
DeAllocate MyCursor
Return
GO
Actually i marked line 777 which produces error. If i take off "authorized = 'N' and canvassType = 'M'", then no error.
Error
--------
Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E14)
Line 1: Incorrect syntax near '='.
/mySite/allPages/test5.asp, line 19
ASP Code
--------------
Const adCmdStoredProc = &H0004
Const adInteger = 3
Const adVarChar = 200
Const adChar = 129
Const adParamOutput = &H0002
Const adParamInput = &H0001
Set cmd = Server.CreateObject ("ADODB.Command")
cmd.ActiveConnection = Con
cmd.CommandText = "LateResponses"
cmd.CommandType = adCmdStoredProc
cmd.Parameters.Append cmd.CreateParameter ("@TableName",adChar,adParamInput,3,"Z30")
cmd.Parameters.Append cmd.CreateParameter ("@Number",adInteger,adParamOutput)
cmd.Parameters.Append cmd.CreateParameter ("@List",adVarChar,adParamOutput,500)
Set rs = cmd.Execute
intCount = cmd.Parameters("@Number")
intList = cmd.Parameters("@List")
Response.Write(intCount&" : "&intList)
SQL Code/Stored Procedure
------------------------------------
CREATE Proc LateResponses(@stableName char(3),@idCount int output,@idList varchar(500) output)
As
Declare @repPeriod char(2)
Declare @repYear char(4)
Declare @repId varchar(11)
Declare @repIds varchar(500)
Declare @recCount int
Declare @sql varchar(100)
Set @repIds = ''
Set @recCount = 0
-- Line 777
SELECT @sql = 'Declare MyCursor Cursor For Select reportPeriod,reportYear,reportid FROM ' + @stableName + '_tbl where authorized = ''N'' and canvassType = ''M'' '
EXEC(@sql)
--Select reportPeriod,reportYear,reportid from MyTable where authorized = 'N' and canvassType = 'M'
Open MyCursor
Fetch Next from MyCursor into @repPeriod,@repYear,@repId
While @@Fetch_Status = 0
Begin
if DateDiff(dd, Cast(@repPeriod+'/28/'+@repYear as DateTime), getDate()) >= 60
set @recCount = @recCount + 1
set @repIds = @repIds + @repId + ','
Fetch Next from MyCursor into @repPeriod,@repYear,@repId
End
Set @idCount = @recCount
Set @idList = @repIds
Close MyCursor
DeAllocate MyCursor
Return
GO