Here's the scenario. My stored proc (on SQL Server 2000) reads thus:
CREATE PROCEDURE dbo.spContactUpdate
(@ContactName nvarchar(50),
@FirstName nvarchar(50) = null,
@LastName nvarchar(50) = null,
@Address1 nvarchar(50) = null,
@Address2 nvarchar(50) = null,
@City nvarchar(50) = null,
@ST nvarchar(50) = null,
@Zip nvarchar(10) = null,
@Phone1 nvarchar(50) = null,
@Phone2 nvarchar(50) = null,
@Fax nvarchar(50) = null,
@Cell nvarchar(50) = null,
@email nvarchar(50) = null,
@ContactID int
)
AS
Update [dbo].[contacts]
set [ContactName] = @ContactName,
[FirstName] = @FirstName,
[Address1] = @Address1,
[Address2] = @Address2,
[City] = @City,
[ST] = @ST,
[Zip] = @Zip,
[Phone1] = @Phone1,
[Phone2] = @Phone2,
[Fax] = @Fax,
[Cell] = @Cell,
[email] = @email
Where Contact_ID = @ContactID
My ASP code reads like this:
cmd.CommandType = AdCmdStoredProc
cmd.CommandText = "spContactUpdate"
cmd.parameters.refresh
'cmd.Parameters.Append cmd.CreateParameter ("RETURN_VALUE",
adInteger, adParamInput, NULL)
cmd.parameters("@RETURN_VALUE") = NULL
cmd.parameters("@ContactName") = strContactName
cmd.parameters("@FirstName") = strFirstName
cmd.parameters("@LastName") = strLastName
cmd.parameters("@Address1") = strAddress1
cmd.parameters("@Address2") = strAddress2
cmd.parameters("@City") = strCity
cmd.parameters("@ST") = strST
cmd.parameters("@Zip") = strZip
cmd.parameters("@Phone1") = strPhone1
cmd.parameters("@Phone2") = strPhone2
cmd.parameters("@Fax") = strFax
cmd.parameters("@Cell") = strCell
cmd.parameters("@email") = stremail
Set paramId = cmd.CreateParameter("@contactid", adInteger,
adParamInput, , strContactID)
cmd.Parameters.Append paramId
cmd.Execute
(for the @ContactID param, I had to write it this way for it to even
run past this point.)
I get the error, "Procedure or function spContactUpdate has too many
arguments specified.", and I check the params by iterating through
them, and get this:
@RETURN_VALUE:
@ContactName: A Little Mouse
@FirstName: Mickey
@LastName: Mouse
@Address1: Addr2
@Address2: Addr2
@City: Burgerville
@ST: AL
@Zip: 38501
@Phone1: 910-290-3942
@Phone2: MyPhone2
@Fax: 801-653-7029
@Cell: 910-444-0932
@email: elbjay2000@mailinator.com
@ContactID:
The first parameter, @RETURN_VALUE, shouldn't be there, and I can't
get rid of it. Outside of this, I think it should work like a charm.
I can't say why my contactID doesn't show at this point. Sorry for all
the details, but I know this is complicated and I wanted to give all
the facts.
Any advice? (please)
Thx!