?
Solved

Title: error: stored procedure has too many arguments specified

Posted on 2006-11-30
10
Medium Priority
?
850 Views
Last Modified: 2012-06-27
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
Comment
Question by:Tiaanvanniekerk
6 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 18051931
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
 

Author Comment

by:Tiaanvanniekerk
ID: 18051954
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
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 672 total points
ID: 18052060
run sql server profiler first and then run this applicatio, check what's coming in the sql server profiler
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 29

Expert Comment

by:Nightman
ID: 18052164
You passing in a string - does any of those variable values have a comma in it?
0
 
LVL 14

Assisted Solution

by:puranik_p
puranik_p earned 664 total points
ID: 18052191
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
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 664 total points
ID: 18058255
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question