Link to home
Start Free TrialLog in
Avatar of garethtnash
garethtnashFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Application uses a value of the wrong type for the current operation

Help,

I'm getting the following error on my asp page -

"/scripts/vacancyview.asp Line Number: 25
Description: Application uses a value of the wrong type for the current operation"

Line 25 on my page is part of a stored procedure that does an insert -

"CMDVacancyView.Parameters.Append CMDVacancyView.CreateParameter("@AdvertID", 3, 1,8,CMDVacancyView__AdvertID)"

It is inserting an int value, I'm just wondering whether there is an issue with the "AdvertID", 3, 1,8" part of the procedure, please advise.

Many thanks

ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of garethtnash

ASKER

Thanks Both, I tried that, but am still getting the following error -

"Full URL: /detail.asp
HTTP User Agent: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) Remote Address: 66.249.66.54 Remote Host: 66.249.66.54 Request Method: GET File Name: /scripts/vacancyview.asp Line Number: 25
Description: Application uses a value of the wrong type for the current operation."

line 25 is -

CMDVacancyView.Parameters.Append CMDVacancyView.CreateParameter("@AdvertID", 3, 1,4,CMDVacancyView__AdvertID)

of -

<%

Dim CMDVacancyView__AdvertID
CMDVacancyView__AdvertID = "0"
if(Request("i") <> "") then CMDVacancyView__AdvertID = Request("i")

Dim CMDVacancyView__SiteID
CMDVacancyView__SiteID = "0"
if(Session("SITEID") <> "") then CMDVacancyView__SiteID = Session("SITEID")

Dim CMDVacancyView__agent
CMDVacancyView__agent = "0"
if(Request.ServerVariables("HTTP_USER_AGENT") <> "") then CMDVacancyView__agent = Request.ServerVariables("HTTP_USER_AGENT")

%>
<%

set CMDVacancyView = Server.CreateObject("ADODB.Command")
CMDVacancyView.ActiveConnection = MM_recruta2_STRING
CMDVacancyView.CommandText = "dbo.usp_AdvertViews"
CMDVacancyView.CommandType = 4
CMDVacancyView.CommandTimeout = 0
CMDVacancyView.Prepared = true
CMDVacancyView.Parameters.Append CMDVacancyView.CreateParameter("@RETURN_VALUE", 3, 4)
CMDVacancyView.Parameters.Append CMDVacancyView.CreateParameter("@AdvertID", 3, 1,4,CMDVacancyView__AdvertID)
CMDVacancyView.Parameters.Append CMDVacancyView.CreateParameter("@SiteID", 3, 1,4,CMDVacancyView__SiteID)
CMDVacancyView.Parameters.Append CMDVacancyView.CreateParameter("@agent", 200, 1,1000,CMDVacancyView__agent)
CMDVacancyView.Execute()

%>

the thing is, if i go to the page directly, it works just fine.. it only appears to be causing an issue for search robots, which it shouldn't because the sp (below) is built to do nothing if it is a search engine -

Please advise - thank you
CREATE PROCEDURE [dbo].[usp_AdvertViews] 
@AdvertID int,
@SiteID int,
@agent nvarchar(1000)
 AS
DECLARE @views int;
 
IF (
@agent NOT LIKE '%Google%' 
AND @agent NOT LIKE '%google%' 
AND @agent NOT LIKE '%slurp%' 
AND @agent NOT LIKE '%twiceler%' 
AND @agent NOT LIKE '%msnbot%' 
AND @agent NOT LIKE '%inspyder%' 
AND @agent NOT LIKE '%baidu%' 
AND @agent NOT LIKE '%BDFetch%' 
AND @agent NOT LIKE '%bdbrandprotect%' 
AND @agent NOT LIKE '%Feed%' 
AND @agent NOT LIKE '%jobcrawler%' 
AND @agent NOT LIKE '%wise-guys%' 
AND @agent NOT LIKE '%tesco%' 
AND @agent NOT LIKE '%Wanadoo%' 
AND @agent NOT LIKE '%eSobiSubscriber%' 
AND @agent NOT LIKE '%Jeeves%' 
AND @agent NOT LIKE '%Jobrapido%' 
AND @agent NOT LIKE '%spbot%' 
AND @agent NOT LIKE '%trovitBot%' 
AND @agent NOT LIKE '%twiceler%' 
AND @agent NOT LIKE '%oodlebot%' 
AND @agent NOT LIKE '%Pingdom%' 
AND @agent NOT LIKE '%PostRank%' 
AND @agent NOT LIKE '%R6_FeedFetcher%'
AND @agent NOT LIKE '%TwitterFeed%'
AND @agent NOT LIKE '%Wget%'
AND @agent NOT LIKE '%Yandex%'
AND @agent NOT LIKE '%SimpleFeed%'   
AND @agent IS NOT NULL) 
BEGIN
SELECT @views=SUM(AdViews) +1
            FROM dbo.JBADView
            WHERE AdvertID = @AdvertID;
 
IF (@views IS NOT NULL)
    UPDATE dbo.JBADView
    SET AdViews = @views
    Where AdvertID = @AdvertID
ELSE 
   INSERT INTO dbo.JBADView(AdvertID, SiteID, AdViews)
       VALUES(@AdvertID, @SiteID, 1)
END
GO

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thank you