Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 855
  • Last Modified:

Title: error: stored procedure has too many arguments specified

HI

where am I going wrong ?

Here is my code from the asp page to execute the strored proc:


session("db").execute("exec bp_createcall '" & callid & "','Addition','" & request("mid") & "','" & session("cscloggeduser") & "','" & request("custid" & cstr(i)) & "','" & request("desc") & "','" + request("add1") & "','" + request("add2") & "','" + request("add3") & "','" & request("refrenceno") & "'")


I am passing 10 arguments.

Here is my strored proc:

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO





ALTER procedure [dbo].[BP_createcall]
@callid varchar(8),
@calltype varchar(100),
@custid varchar(100),
@technician varchar(100),
@edc varchar(100),
@desc varchar(1000),
@add1 varchar(100),
@add2 varchar(100),
@add3 varchar(100),
@refrenceno varchar (25)

as

declare @hs int
declare @nowdate varchar(10)
declare @nowtime varchar(8)
declare @pa1 varchar(100)
declare @pa2 varchar(100)
declare @pa3 varchar(100)
declare @pc varchar(10)
declare @a1 varchar(100)
declare @a2 varchar(100)
declare @a3 varchar(100)
declare @country varchar(100)
declare @province varchar(100)
declare @name varchar(100)
declare @trading varchar(100)
declare @status varchar(100)
declare @slazone varchar(100)
declare @city varchar(100)
declare @tel varchar(100)
declare @fax varchar(100)
declare @contact varchar(100)
declare @contactcell varchar(100)
declare @contactemail varchar(100)
declare @bank varchar(100)
declare @application varchar(10)
declare @amex varchar(10)
declare @diners varchar(10)
declare @visa varchar(10)
declare @master varchar(10)
declare @fleet varchar(10)
declare @fastnet varchar(10)
declare @cashback varchar(10)
declare @cashlimit varchar(10)
declare @other varchar(10)
declare @privatelabel varchar(10)
declare @chequeveri varchar(10)
declare @bonus varchar(10)
declare @debitcard varchar(10)
declare @keycard varchar(10)
declare @manualauth varchar(10)
declare @apptype varchar(100)
Declare @userid varchar (10)
declare @termtype varchar(100)
declare @modemtype varchar(100)
declare @merchid varchar(100)

Select @refrenceno=subset.refrenceno from inserted

select @a1 = physical_address1,@a2 = physical_address2,@a3 = physical_address3, @pa1 = postal_address1,
@pa2 = postal_address2, @pa3 = postal_address3,@pc = postal_addresscode,@country = country,@province = province,
@name = name,@trading = tradingname,@status = status,@slazone = slazone,@city = city,@tel = telephone,@fax = fax,
@contact = contact,@contactcell = contactcell,@contactemail = contactemail,@bank = bank,@application = application,
@apptype = applicationtype
from profile where custid = @custid


set @hs = datediff(ss,'1970-01-01',getutcdate())
set @nowdate = convert(varchar(10),getdate(),120)
set @nowtime = convert(varchar(8),getdate(),108)

set @callid = left('00000000',8-len(@callid)) + @callid

if len(@add1) > 0 or len(@add2) > 0 or len(@add3) > 0
begin
            set @pa1 = @add1
            set @pa2 = @add2
            set @pa3 = @add3
end



insert into subset
(custid,
callid,
custtype,
refrenceno,
physical_address1,
physical_address2,
physical_address3,
postal_address1,
postal_address2,
postal_address3,
postal_addresscode,
country,
province,
name,
tradingname,
status,
slazone,
city,
telephone,
fax,
contact,
contactcell,
contactemail,
bank,
application,
applicationtype,
technician)
values
(@custid,
@callid,
'BP',
@refrenceno,
@a1,
@a2,
@a3,
@pa1,
@pa2,
@pa3,
@pc,
@country,
@province,
@name,
@trading,
@status,
@slazone,
@city,
@tel,
@fax,
@contact,
@contactcell,
@contactemail,
@bank,
@application,
@apptype,
@technician)

insert into calllog
(callid,
custid,
custtype,
calltype,
callstatus,
priority,
cduration,
callcount,
stopwatch,
recvddate,
recvdtime,
recvdby,
moddate,
modtime,
modby,
dtlastmod,
callsource,
category,
calldesc,
tracker)
values
(@callid,
@custid,
'BP',
@calltype,
'Open',
'1',
0,
0,
0,
@nowdate,
@nowtime,
@technician,
@nowdate,
@nowtime,
@technician,
@hs,
'Web',
'',
@desc,
@technician)

if not exists(select * from detail where callid = @callid)
begin
      if @calltype = 'Addition' or @calltype = 'Installation'
      begin
            insert into detail (callid,proposed_new_userid)
            values (@callid,@edc)
      end
      else
      begin
            select @termtype = terminaltype, @modemtype = modemtype, @apptype = applicationtype, @merchid = merchantnumber, @userid = userid
            from profile where custtype = 'Equipment' and custid = @edc

            insert into detail (callid,terminalsn,terminaltype,modemtype,applicationtype,merchantnumber,userid)
            values (@callid,@edc,@termtype,@modemtype,@apptype,@merchid,@userid)
      end
end

return @callid





GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO



0
Tiaanvanniekerk
Asked:
Tiaanvanniekerk
3 Solutions
 
Aneesh RetnakaranDatabase AdministratorCommented:
I am not sure about the asp syntax, can you try prefixing the object owner

session("db").execute("exec dbo.bp_createcall '" & callid & "','Addition','" & request("mid") & "','" & session("cscloggeduser") & "','" & request("custid" & cstr(i)) & "','" & request("desc") & "','" + request("add1") & "','" + request("add2") & "','" + request("add3") & "','" & request("refrenceno") & "'")
0
 
TiaanvanniekerkAuthor Commented:
Hi
I did and still the same problem if I take one of the arguments out it works but I have to pass all of them
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
run sql server profiler first and then run this applicatio, check what's coming in the sql server profiler
0
A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

 
NightmanCTOCommented:
You passing in a string - does any of those variable values have a comma in it?
0
 
puranik_pCommented:
my guess is, you are getting a ',' in the value of one of the parameters which is being interpreted as another parameter.
Why don't you go the parameter way ...?

pasted from http://support.microsoft.com/kb/q164485/

<%
   Set cn = Server.CreateObject("ADODB.Connection")
   cn.Open "data source name", "userid", "password"
   Set cmd = Server.CreateObject("ADODB.Command")
   Set cmd.ActiveConnection = cn
   cmd.CommandText = "sp_test"
   cmd.CommandType = adCmdStoredProc
   cmd.Parameters.Append cmd.CreateParameter("RetVal", adInteger, _
      adParamReturnValue)
   cmd.Parameters.Append cmd.CreateParameter("Param1", adInteger, _
      adParamInput)
   ' Set value of Param1 of the default collection to 22
   cmd("Param1") = 22
   cmd.Execute
   %>
   Calling via method 2<BR>
   ReturnValue = <% Response.Write cmd(0) %><P>


This is the safest way to call a procedure.

Pura
0
 
Anthony PerkinsCommented:
One of your Request variables must be Null.  For trouble shooting purposes only add the following prior to the Execute method:
Response.Write "exec bp_createcall '" & callid & "','Addition','" & request("mid") & "','" & session("cscloggeduser") & "','" & request("custid" & cstr(i)) & "','" & request("desc") & "','" + request("add1") & "','" + request("add2") & "','" + request("add3") & "','" & request("refrenceno") & "'" & "<br>"
Response.End

If the reason is not obvious, post the output here.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now