Procedure or function has too many arguments specified - just two parameters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • programmher
    New Member
    • Jan 2014
    • 19

    #1

    Procedure or function has too many arguments specified - just two parameters

    I have a button that calls a delete stored procedure with only two parameters. I can run the stored procedure via SQL manager and know it works. But, when I call the stored procedure from a sqldatasource on the .aspx page I get this error: Procedure or function has too many arguments specified.

    Here is my code:

    Code:
    <asp:SqlDataSource runat="server" ID="sqlAuthorsInfo" ConnectionString="<%$ ConnectionStrings:Authors %>" ProviderName="<%$ ConnectionStrings:Authors.ProviderName %>" 
        SelectCommand="FindAuthors" SelectCommandType="StoredProcedure" DeleteCommandType="StoredProcedure" DeleteCommand="Remove_Authors">
        <SelectParameters>
            <asp:QueryStringParameter Name="authorcode" Type="Int32" QueryStringField="id" />
        </SelectParameters>
         <DeleteParameters>
            <asp:QueryStringParameter Name="authorcode" Type="Int32" QueryStringField="id" />
            <asp:ProfileParameter Name="AuthorID" Type="Int32" PropertyName="UserID" />  
                   </DeleteParameters>
    </asp:SqlDataSource>
    
    
    
         <asp:GridView runat="server" ID="gvAuthors" DataSourceID="sqlAuthorsInfo AutoGenerateColumns="false"  DataKeyNames="AuthorName" >
        <Columns>
            <asp:TemplateField ItemStyle-CssClass="basicItem">
                <ItemTemplate>
                        <asp:ImageButton ID="Delete"  runat="server" CommandName="Delete" /delete.png" />
                </ItemTemplate>
            </asp:TemplateField>
            
            <asp:BoundField DataField="AuthorName" HeaderText="Author Name" DataFormatString="{0:g}"   />
               
        </Columns>
    </asp:GridView>
    Here is how the stored procedure looks - it is very simple:

    Code:
    DECLARE @authorcode int, @authorid int
    
    DELETE FROM Requests
    WHERE authorcode = @authorcode
    AND authorid = @authorid
    What is wrong? How do I resolve this???
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    What is the full stored procedure code?

    I see two variables and zero parameters in the body of the stored procedure. The header of the stored procedure definition will list the parameters.

    Comment

    Working...