Solved

Procedure or function has too many arguments specified.

Posted on 2008-10-10
2
2,084 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

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…
Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
This video teaches users how to migrate an existing Wordpress website to a new domain.
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…

830 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