SQLDataSource Error Message is Procedure or function 'SomeFunctionName' has too many arguments specified

Posted on 2009-04-20
Last Modified: 2012-06-21
I have put together a simple web page with a gridview and an SQLDataSource.  I have a stored procedure to add/update some data and I cannot get the parameter conventions right and/or there are some issues with duplication of parameters within the Visual Studio 2005 IDE
Here is the relevant snippets:

      <asp:SqlDataSource ID="SqlDataSourceClientLogin" runat="server" 

          ConnectionString="<%$ ConnectionStrings:SOME_DSN %>" 

          SelectCommand="SELECT * FROM ClientLogin" 





            <asp:Parameter  Name="pClientGuid" Type="String" Size="80" Direction="Input"  DefaultValue="382FC1C7-0618-4A72-A832-36C0480B5AF6" ConvertEmptyStringToNull="true"/>      

            <asp:Parameter  Name="pPWD" Type="String" Size="80" Direction="Input" DefaultValue="123" ConvertEmptyStringToNull="true"/>      

            <asp:Parameter  Name="pSalutation" Type="String" Size="80" Direction="Input" DefaultValue="Mr." ConvertEmptyStringToNull="true"/>      

            <asp:Parameter  Name="pFName" Type="String" Size="80" Direction="Input" DefaultValue="Howie" ConvertEmptyStringToNull="true"/>      

            <asp:Parameter  Name="pLName" Type="String" Size="80" Direction="Input" DefaultValue="Bashevkin" ConvertEmptyStringToNull="true"/>      

            <asp:Parameter  Name="pTitle" Type="String" Size="80" Direction="Input" DefaultValue="Bozo" ConvertEmptyStringToNull="true"/>      

            <asp:Parameter  Name="pMgmtLevel" Type="String" Size="80" Direction="Input" DefaultValue="King" ConvertEmptyStringToNull="true"/>      

            <asp:Parameter  Name="pEmail" Type="String" Size="80" Direction="Input" DefaultValue="" ConvertEmptyStringToNull="true"/>      







      <asp:GridView ID="GridView2" runat="server" DataSourceID="SqlDataSourceClientLogin" AutoGenerateColumns="False" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical">



          <asp:BoundField DataField="ClientGuid" HeaderText="ClientGuid" />  

          <asp:BoundField DataField="PhoneNumberGuid" HeaderText="PhoneNumberGuid" />  

          <asp:BoundField DataField = "PWD" HeaderText="Password" />  

          <asp:BoundField DataField = "Salutation" HeaderText="Salutation" />  

          <asp:BoundField DataField = "FName" HeaderText="First Name" />  

          <asp:BoundField DataField = "LName" HeaderText="Last Name" />  

          <asp:BoundField DataField = "Title" HeaderText="Title" />  

          <asp:BoundField DataField = "MgmtLevel" HeaderText="MgmtLevel" />  

          <asp:BoundField DataField = "Email" HeaderText="Email" />  

          <asp:BoundField DataField = "PublicFlag" HeaderText="PublicFlag" />  

          <asp:BoundField DataField = "LoginType" HeaderText="LoginType" />  

          <asp:BoundField DataField = "LoginCount" HeaderText="LoginCount" />  


            <asp:TemplateField HeaderText="Business Category Name">


                <asp:DropDownList ID="DropDownList1" DataSourceID="SqlDataSourceBusCat" DataTextField="BusnCategoryName" runat="server">





            <asp:TemplateField HeaderText="Business SubCategory Name">


                <asp:DropDownList ID="DropDownList2" DataSourceID="SqlDataSourceBusSubCat" DataTextField="BusnSubCategoryName" runat="server">




            <asp:CommandField ShowEditButton="True" />




          <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />

          <RowStyle BackColor="#EEEEEE" ForeColor="Black" />

          <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />

          <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />

          <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />

          <AlternatingRowStyle BackColor="Gainsboro" />




also two other sqldatasources are omitted (for the dropdowns) and when I run it I get the above after I click edit, the link buttons become update/cancel and I click update.  I then get the error in the title.

Finally here are the params for the stored proc (AddUpdateClient) for the update:

    @pClientGuid uniqueidentifier,

    @pPWD varchar(50),

    @pSalutation nchar(10),

    @pFName varchar(50),

    @pLName varchar(50),

    @pTitle varchar(50),

    @pMgmtLevel varchar(50),

    @pEmail varchar(80),

    @pWorkedOnClientGuid uniqueidentifier output

Open in new window

Question by:hbash
    LVL 10

    Expert Comment

    Have any error message?  (it could help us)

    Have you tried to execute your storeproc in the query analyser?  If so, can you get us the list of columns that you get?  Make sure that all your columns defined in the BoundField are correctly named according to the resultset.

    I also notice that your update parameter "pClientGUID" is a string.  I don't know if a GUID can be taken literally as a string, but i guess you have made your search about the validity of this.

    I also notice that all your boundfield are varchar(80), while your AddUpdateClient storeproc are 50,10, and 80 width...

    You also have pWorkedOnClientGuid defined as a GUID, for OUTPUT.  Shouldn't you define it in your update parameters with the proper "direction"?
    LVL 1

    Author Comment

    When  click the update link I get this error on a page:
    "Procedure or function 'SomeFunctionName' has too many arguments specified"

    Also, when I set a break on the SQLDataSource's Updating event,  I get other columns that  did not specify.

    Please adise.

    LVL 10

    Expert Comment

    Sorry, but re-read what you just wrote me, and tell me how i can help you with this?
    You don't give me enough informations, and do not even answer.

    What columns do you get and that you didn't specified?  I don't understand...

    so please, Try & Answers here:
    1- Try it in Query Analyser.  Does it work?
    2- If you specify the same Width than you defined in your storeproc, do you have the same problem?
    3- Are you sure that a GUID can be considered as a string in an SQLDataSource? (sorry to insist, but i've never tried that.  You might try to set your storeproc parameter to VARCHAR(...) and convert it back to GUID in your SP (if you can do that))
    4- There's some missing parameters (pWorkedOnClientGUID).  Have you tried to just declare it in your UpdateParameters?  If so, have the same error message?

    Once i get theses answers, i'll help
    LVL 1

    Accepted Solution

    Your first question: "What is the error"  is in the subject and repeated in my reply and here again for the third time

    >>>> "Procedure or function 'SomeFunctionName' has too many arguments specified" <<<<

    1. It works in the query analyzer.

    2. Will adjust the widths, but not sure how to define the datatype and with for the uniqueidentifier.  I tried string but made the width way wider than needed.

    3. I tried the proc in query analyzer and it worked.  I then did a select for the autogenerated guid using the value single quoted just like any other string and it retrieved the row.

    4. I have declared the output parameter also and the same error message is displayed.

    Also,  googling on this error,  you will see many results with no general answer, but that in the Updating event,  you can see that the parameters are either not there (not specifying in the SQLDataSource element)  or are there along with all the table's column names.

    LVL 10

    Expert Comment

    Your gridview contain many columns that are not in your UpdateCommand.  If you keep the same number of parameters, it will work, otherwise, it will give you the same error message (i've tested it, and i got your error)

    LVL 10

    Expert Comment

    Ok, now the question comming is ... "but i don't want to update all theses informations!  There's only few columns i want to update, not all of them!"

    Then you should place a READONLY="TRUE" in your BoundField.  Theses columns will only show up in "ShowMode" but not in Edit Mode and you won,t have this problem anymore.

    So theses parameters should be placed as "readonly":
    - PhoneNumberGuid
    - PublicFlag
    - LoginType
    - LoginCount

    Also, make sure that your columns are named the same way...
    What i mean is that if in your GridView you have a name like this: ClientGuid, name it the same way in the update parameters.  So no pClientGuid...
    So you will have to redefine your SP.
    LVL 10

    Expert Comment

    I do not object, this can be closed.

    Its sad for people who are looking for an answer to this kind of problem, but i agree, too much crap who concern people and not the problem mentionned, have been written in the comments.  And i can live with less points...  I'm already paying for my account here, i'm not paid by E-E and i'm just doing this to help.
    LVL 1

    Author Comment

    At the time of this incident,  I did not see a request attention link so the best I was able to do was to submit requests to look at this thread to various groups.

    And yes, it is sad when people have to resort to vulgar language especially in a public forum.  If anything that I said to this "person" was inappropriate I'd appreciate your pointing me at that.

    Netminder, speaking for myself,  when someone attacks me, I respond.  And, none of my responses even remotely approached the slime that was flung at me.  From the "f..." remark to the "let me drown" nonsense,  responding at all directly to this vitriole does indeed lower my standards as well.


    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit ( and similar technologies have enjoyed wide adoption, making it possib…
    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra… provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
    Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now