We help IT Professionals succeed at work.

How do I fix this error?

I have the Update in the TableAdapter use a sp. One of the Parameters is CustomerID, which is set as Input. Now when this sp tries to execute I am getting an error. This is the error:
>Formal parameter '@CustomerID' was defined as OUTPUT but the actual parameter not declared OUTPUT

I'm not sure what is mean by "Formal" and "Actual".  Is this difficult to fix?


Comment
Watch Question

Guy Hengel [angelIII / a3]Billing Engineer
GOLD EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
formal/actual is the difference between how the parameter is defined in the procedure vs how you define it in your .net code.
>One of the Parameters is CustomerID, which is set as Input.
so, the procedure probably defines it as OUTPUT parameter, so you have to adjust the .net code accordingly.

if that is not clear enough, post the relevant code.

Author

Commented:
but in the Procedure it is not defined as Output, here is the procedure:

CREATE PROCEDURE dbo.spCustomer_Update

(
      @CustomerName varchar(40),
      @Address varchar(90),
      @City varchar(30),
      @State char(2),
      @Zip varchar(10),
      @Phone varchar(20),
      @Fax varchar(20),
      @Website varchar(60),
      @Email varchar(50),
      @Comment varchar(4096),
      @CustomerID int,
      @Modified Timestamp OUTPUT
)
BRONZE EXPERT

Commented:
I think formal means delcared in code

actual means in store proc

In this you have declare culstomerid as output in code so remove that...


otherwise share your code with us
Senior Database Administrator
BRONZE EXPERT
Commented:
Hi,

>> but in the Procedure it is not defined as Output

True.

But the procedure shows that the next parameter is declared as output
>> @Modified Timestamp OUTPUT

I would hazard a guess that maybe you have @CustomerID declared as output in .net, or @Modified is not defined as output and should be.

Did you write the procedure? Is it an existing procedure used by other code, or a new procedure?

Cheers
  David

Author

Commented:
dtodd
I found the problem.
In fact I had set it using the designer and the CustomerID originally had been set as InputOutput and I had changed it, and it shows as such in the Designer. But the Code it write didn't change. So I went in and changed it by hand, and now it seems to work.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.