Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8935629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:02:00+00:00 2026-06-15T10:02:00+00:00

I have a gridview that I am attempting to update the row. If I

  • 0

I have a gridview that I am attempting to update the row. If I put a breakpoint on the row updating event it gets hit the first time through and the row is updated successfully. As I continue to step through that code is not hit a second time, however I get an exception that the stored procedure from that update has too many parameters and throws an error.

I do have the autoeventwireup set to true. Is this a problem? I tried setting it to false but I have other things going on in the page_load that doesn’t happen and breaks the page. Plus, from what I’ve read it might not be the issue. Any help is greatly appreciated!

Here is the stack trace on the error

[SqlException (0x80131904): Procedure or function RecordingUpdateName has too many arguments specified.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2084358
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5096328
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2294
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +215
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +987
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +178
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +137
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +394
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +697
   System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +95
   System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation) +1226
   System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +855
   System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e) +95
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +121
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +125
   System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +169
   System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +9
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +176
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563

And:

<asp:GridView ID="grdvwRecordings" runat="server"
    DataSourceID="sqldataRecordings"
    EmptyDataText="No recordings have been saved. Select Call Now below. "
    DataKeyNames="RecordingID"
    onrowdeleting="grdvwRecordings_RowDeleting"
    onrowupdating="grdvwRecordings_RowUpdating"
    onrowediting="grdvwRecordings_RowEditing"
    AutoGenerateColumns="False"
    onrowdatabound="grdvwRecordings_RowDataBound">

    <Columns>
        <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
        <asp:TemplateField HeaderText="Recording">
            <ItemTemplate>
                <asp:Label ID="lblRecordingName" Text='<%# Bind("Name") %>' runat="server"></asp:Label>
            </ItemTemplate>
            <EditItemTemplate>
                <asp:TextBox ID="txtRecordingName" Text='<%# Bind("Name") %>' runat="server"></asp:TextBox>
            </EditItemTemplate>
        </asp:TemplateField>

        <asp:TemplateField HeaderText="Date Recorded">
            <ItemTemplate>
                <asp:Label ID="lblDateRecorded" Text='<%# Bind("EntryDate") %>' runat="server"></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>

        <asp:TemplateField HeaderText="Duration">
            <ItemTemplate>
                <asp:Label ID="lblDuration" Text='<%# Bind("Duration") %>' runat="server"></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>
<asp:SqlDataSource ID="sqldataRecordings" SelectCommand="[RecordingSelectByClient]"
   SelectCommandType="StoredProcedure" runat="server"
   ConnectionString="<%$ ConnectionStrings:VB %>"
   onselecting="AddClientIDParameter_Selecting"
   UpdateCommand="RecordingUpdateName"
   UpdateCommandType="StoredProcedure"
   DeleteCommand="RecordingDelete"
   DeleteCommandType="StoredProcedure">

    <UpdateParameters>
        <asp:Parameter Name="RecordingName" Type="String" />
        <asp:Parameter Name="RecordingID" Type="Int32" />
    </UpdateParameters>

</asp:SqlDataSource>

And:

protected void grdvwRecordings_RowUpdating(object sender, GridViewUpdateEventArgs e)
{

   this.sqldataRecordings.UpdateParameters["RecordingID"].DefaultValue = e.Keys["RecordingID"].ToString();
   this.sqldataRecordings.UpdateParameters["RecordingName"].DefaultValue = e.NewValues["Name"].ToString();

    this.sqldataRecordings.Update();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:02:02+00:00Added an answer on June 15, 2026 at 10:02 am

    Please try the following:

    Remove onrowupdating="grdvwRecordings_RowUpdating" from the GridView attributes

    In the SqlDataSource tag replace the UpdateParameters with:

    <UpdateParameters>
        <asp:QueryStringParameter Name="RecordingName" QueryStringField="Name" Type="String" />
        <asp:QueryStringParameter Name="RecordingID" QueryStringField="RecordingID" Type="String" />
    </UpdateParameters>
    

    I think what is happening is you are specifying your update command once in the GridView (using the OnRowUpdated attribute) and once in the SqlDataSource.

    Edit:
    As Tim Brooks indicated in the comments below, he needed to use <%# Eval("Name") %> instead of Bind, as the bound fields were automatically being added as parameters to the update command.

    Also, I would not worry about exposing your primary key by making my suggested changes. Since this is a web app and you are getting the RecordingID from the GridViewUpdateEventArgs you are already passing the information down to the user’s computer in the ViewState. If this is not acceptable I suggest you encrypt the ViewState. There may be a noticeable performance hit, but the ViewState will be safe from reading.
    See Page.ViewStateEncryptionMode Property, Encrypt ViewState in ASP.NET 2.0, and Securing View State for more information.

    If you need a primer on ViewState You might start with this post, but I am sure there are many other good ones out there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET GridView that has four columns. The first three are typical
I have a gridview that I want to read, delete, edit and update, I
I have a gridview that is filled correctly from 3 tables. When I update
I have a gridview that gets its data from a webservice. This comes into
So i have a dropdownlist in a gridview that i am attempting to get
I have a gridview with an enormous viewstate that I am attempting to shrink.
I have a gridview that needs to be exported to Excel. I have managed
I have a gridview that shows an image as part of one of its
I have a gridview that displays items details, I added two template fields one
I have a gridview that is only shown in a modal popup. right before

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.