vs2010 asp.net : Procedure or function expects parameter which was not supplied.
- by dotnet-practitioner
I have googled for this issue but listed solutions are not working for me...
I get the following error message:
Procedure or function 'ContactHide' expects parameter '@ContactID', which was not supplied.
Here is my setup..What am I missing? Please help? Debugger shows that I am supplying ContactID correctly in my C# code behind code.
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:MYDBConnectionString1 %>"
UpdateCommand="ContactHide" UpdateCommandType="StoredProcedure"
>
int contactid= Convert.ToInt32(e.CommandArgument);
SqlDataSource2.UpdateParameters.Add("@ContactID", System.Data.DbType.Int32, "1");
SqlDataSource2.UpdateParameters["@ContactID"].DefaultValue = contactid.ToString();
SqlDataSource2.Update();
ALTER PROCEDURE dbo.ContactHide
@ContactID int
/*
(
@parameter1 int = 5,
@parameter2 datatype OUTPUT
)
*/
AS
Update Contacts set Visible = 0 where ContactID = isnull(@ContactID,-1)
/* SET NOCOUNT ON */
RETURN