Solved

Procedure or function has too many arguments specified.

Posted on 2008-10-10
2
2,073 Views
Last Modified: 2012-05-05
Exception Details: System.Data.SqlClient.SqlException: Procedure or function spBSCTROPQuestionSequenceUpdate has too many arguments specified.

Here is how I got it.
  1. Create a stored procedure for selection  and another to update one column, using primary key
  2. Use a SqlDataSource referencing these two stored procedures
  3. Add a Gridview with DataSourceID = SqlDataSource ID
  4. Add a button to Gridview for Edit/Update
  5. Run web page, Click Edit, then Update!
  6. Gets SqlDataException: Procedure or function spBSCTROPQuestionSequenceUpdate has too many arguments specified.

Goal is to do update using stored procedure.
Any ideas?
0
Comment
Question by:brotherbill999
2 Comments
 
LVL 32

Accepted Solution

by:
Daniel Wilson earned 500 total points
ID: 22688969
Can you post the stored procedure?
0
 

Author Comment

by:brotherbill999
ID: 22689046
Found solution...
The key is in the GridView_RowUpdating Event to Clear the values, then enter those just needed for the stored procedure.

ALTER PROCEDURE [dbo].[spUpdate]
      @id     AS int,
      @seq AS smallint
   AS
   UPDATE BSCTROP_Questions
      SET
          Sequence = @sequence
      WHERE
           ID = @id

Found Solution...
    Protected Sub gvQuestions_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles gvQuestions.RowUpdating
        Dim id As Integer = e.Keys.Item("ID")
        Dim sequenceNew As Int16 = e.NewValues()("Sequence")

        e.NewValues.Clear()
        e.NewValues()("id") = id
        e.NewValues()("sequence") = sequenceNew
    End Sub

0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

810 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