Solved

Procedure or function has too many arguments specified.

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Using Quotation Marks in PHP This question (http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_28217211.html) seems to come up a lot for developers who are new to PHP.  And it got me thinking, "How can we explain the rule…
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…
This video teaches users how to migrate an existing Wordpress website to a new domain.

757 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

18 Experts available now in Live!

Get 1:1 Help Now