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

Posted on 2009-04-20
Medium Priority
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="howardbash@yahoo.com" 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:Howard Bash
  • 5
  • 3
LVL 10

Expert Comment

by:Christian de Bellefeuille
ID: 24190531
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"?

Author Comment

by:Howard Bash
ID: 24190911
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

by:Christian de Bellefeuille
ID: 24195136
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

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.


Accepted Solution

Howard Bash earned 0 total points
ID: 24197540
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

by:Christian de Bellefeuille
ID: 24198005
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

by:Christian de Bellefeuille
ID: 24198184
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

by:Christian de Bellefeuille
ID: 24206838
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.

Author Comment

by:Howard Bash
ID: 24208298
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
Wufoo.com 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.
Suggested Courses
Course of the Month13 days, 8 hours left to enroll

750 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