Solved

Procedure or function has too many arguments specified.

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Video/Image Streaming/Desktop Sharing 6 75
Tech Writing Terminology - Pane or Panel? 8 77
How to convert Access database to a web app? 3 343
Image Orientation On Website 6 51
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…
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 selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

910 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