Solved

Procedure or function has too many arguments specified.

Posted on 2008-10-10
2
2,104 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

If I have to fix slow responding website my first thoughts are server side optimizations: the database may not be optimized or caching is not enabled, or things like that. We often overlook another major part of our web application: the client. We o…
Developer tools in browsers have been around for a while, yet they are still heavily underused by developers. Developers still fix html or CSS then refresh page to see effect, or they put alert or debugger in JavaScript and then try again and again …
This video teaches users how to migrate an existing Wordpress website to a new domain.
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.

710 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