Click here to Skip to main content
15,900,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have making one store procedure for updating the data of administrator my store procedure is look like..
--------------------------------------------------------------
SQL
ALTER PROCEDURE [dbo].[edit_admindetails]
@ID int,
@Name nvarchar(250),
@Address nvarchar(max),
@MobileNo varchar(11),
@PhoneNo varchar(20),
@EmailId varchar(50)

AS
	BEGIN
	UPDATE  dbo.UserInfo SET
	Name=@Name,
	Address=@Address,
	MobileNo=@MobileNo,
	PhoneNo=@PhoneNo,
	EmailID=@EmailID
	WHERE ID=@ID
	END

but it shows me error like .............
Msg 201, Level 16, State 4, Procedure edit_admindetails, Line 0
Procedure or Function 'edit_admindetails expects parameter @ID, which was not supplied

anyone help me... thanks..
Posted
Updated 24-Aug-12 20:44pm
v2

Because when you are calling this stored procedure you didnt pass @Id as input parameter.

It should be like this
SQL
exec edit_admindetails 1,'namesomething','addresssoemthing','mobnosomething','phonenosomething,'emailsomthing


You can see i passed 6 parameters
 
Share this answer
 
Comments
Wendelius 25-Aug-12 15:30pm    
Exactly, my 5
Santosh's answer is correct, you have to supply all the mandatory parameters to the stored procedure.

However, if you have a situation that sometimes you don't know a value for a parameter and you want to use a default value, you can define a default for a parameter. For example:
SQL
ALTER PROCEDURE [dbo].[edit_admindetails]
   @ID int,
   @Name nvarchar(250),
   @Address nvarchar(max),
   @MobileNo varchar(11),
   @PhoneNo varchar(20),
   @EmailId varchar(50) = null
AS
...

With the definition above you don't need to supply emailid. If it isn't supplied, the default value of null is used inside the procedure.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900