Solved

Title: error: stored procedure has too many arguments specified

Posted on 2006-11-30
10
838 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
10 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 168 total points
ID: 18052060
run sql server profiler first and then run this applicatio, check what's coming in the sql server profiler
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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 166 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 166 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now