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 5960057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:46:20+00:00 2026-05-22T18:46:20+00:00

i have datasource which has an sp called for update and been binded to

  • 0

i have datasource which has an sp called for update and been binded to gridview. i want while updating it should use the sp and update table.
Below is my design code.

 < asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
        DataKeyNames="Title" DataSourceID="SqlDataSource1" EnableModelValidation="True"
        ForeColor="#333333" GridLines="None" ShowFooter="True" Width="1000" AllowPaging="true"
        PageSize="10" OnRowCommand="GridView1_RowCommand">  
        < AlternatingRowStyle BackColor="White" ForeColor="#284775" />  
        < Columns>  
            < asp:TemplateField HeaerText="Title">  
                < ItemTemplate>  
                    < asp:Label ID="lblTitle" runat="server" Text='<%# Eval("Title") %>'></asp:Label>  
                < /ItemTemplate>  
            < /asp:TemplateField>  
            < asp:TemplateField HeaderText="Quote">  
                < ItemTemplate>  
                    <%# Eval("Quote") %>  
                < /ItemTemplate>  
                < EditItemTemplate>  
                    < asp:TextBox ID="txtEditQuote" runat="server" Text='<%# Bind("Quote") %>'></asp:TextBox>  
                < /EditItemTemplate>  
            < /asp:TemplateField>  
            < asp:TemplateField HeaderText="Quote Link">   
                < ItemTemplate>  
                    < %# Eval("QuoteLink") %>  
                < /ItemTemplate>  
                < EditItemTemplate>  
                     < asp:TextBox ID="txtEditQuoteLink" runat="server" Text='<%# Bind("QuoteLink") %>'>< /asp:TextBox>  
                < /EditItemTemplate>   
             < /asp:TemplateField>  
            < asp:TemplateField HeaderText="Published">  
                < ItemTemplate>  
                    < asp:CheckBox ID="chkBox" runat="server" Checked='<%# Convert.ToBoolean(Eval("Published")) %>' 
                        Enabled="false" />  
                < /ItemTemplate>  
                < EditItemTemplate>  
                    < asp:CheckBox ID="chkEditBox" runat="server" Checked='<%# Bind("Published") %>'  Enabled="true" />  
                < /EditItemTemplate>  
            < /asp:TemplateField>  
            < asp:TemplateField HeaderText="PublishedDate">  
                < ItemTemplate>  
                    < %# Convert.ToDateTime(DataBinder.Eval(Container.DataItem,"PublishedDate")).ToString("MM.dd.yyyy") %>  
                < /ItemTemplate>  
                < EditItemTemplate>  
                    < asp:TextBox ID="txtEditPublishedDate" runat="server" Text='<%# Bind("PublishedDate") %>'>< /asp:TextBox>  
                < /EditItemTemplate>  
            < /asp:TemplateField>  
            < asp:TemplateField HeaderText="Commands">  
                < ItemTemplate>  
                    < asp:Button runat="server" ID="Edit" Text="Edit" CommandName="Edit" />  
                    < asp:Button runat="server" ID="Delete" Text="Delete" CommandName="Delete" />  
                < /ItemTemplate>  
                < EditItemTemplate>  
                    < asp:Button runat="server" ID="Update" Text="Update" CommandName="Update" CommandArgument='<%# Container.DataItemIndex %>' />  
                    < asp:Button runat="server" ID="Cancel" Text="Cancel" CommandName="Cancel" />  
                < /EditItemTemplate>  
            < /asp:TemplateField>  
        < /Columns>  
        < EditRowStyle BackColor="#999999" />  
        < FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />  
        < HeaderStyle BackColor="#5D7B9D" Font-Bold="True" HorizontalAlign="Left" ForeColor="White" />  
        < PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />  
        < RowStyle BackColor="#F7F6F3" ForeColor="#333333" />  
        < SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />  
    < /asp:GridView>  
    < asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>" 
        SelectCommand= "SELECT [TITLE], [QUOTE], [QUOTELINK], [PUBLISHED], [PUBLISHEDDATE] FROM [DBO].[QUOTES]"
        UpdateCommand="sp_ModifyQuotes" UpdateCommandType="StoredProcedure">  
        < UpdateParameters>  
            < asp:Parameter Name="Title" Type="String" />  
            < asp:Parameter Name="Quote" Type="String" />  
            < asp:Parameter Name="QuoteLink" Type="String" />  
            < asp:Parameter Name="Published" Type="Boolean" />   
            < asp:Parameter Name="PublishDate" Type="DateTime" />  
            < asp:Parameter Name="Modify" Type="String" DefaultValue="Update" />  
        < /UpdateParameters>  
    < /asp:SqlDataSource>  

and below is my SP

ALTER PROCEDURE [dbo].[sp_ModifyQuotes]
    @Title varchar(max),
    @Quote varchar(max),
    @QuoteLink varchar(max),
    @Published Bit,
    @PublishDate DateTime,
    @Modify varchar(10)

AS
BEGIN
    Declare @QuoteId int
    IF (@Modify = 'Add')
    BEGIN
        INSERT INTO dbo.QUOTES
        (
            Title,
            Quote,
            QuoteLink,
            Published,
            PublishedDate
        )
        values
        (
            @Title,
            @Quote,
            @QuoteLink,
            @Published,
            @PublishDate
        )
        SET @QuoteId = @@IDENTITY
        If @Published = 1
        BEGIN
            UPDATE dbo.Quotes SET Published = 0 WHERE Id <> @QuoteId AND Published = 1
        END
        --SELECT @QuoteId As ID
    END
    ELSE IF (@Modify = 'Update')
    BEGIN
        UPDATE dbo.Quotes SET
        Quote = @Quote,
        QuoteLink = @QuoteLink,
        Published = @Published,
        PublishedDate = @PublishDate

        WHERE Title = @Title
        --SELECT '1' As ID

    END
    ELSE IF (@Modify = 'Delete')
    BEGIN
        DELETE FROM dbo.Quotes
        WHERE Title = @Title

        --SELECT '1' As ID
    END
END

please any one help me how should i update my records when i try to update i gets an error saying:

Procedure or function sp_ModifyQuotes
has too many arguments specified.

but i guess i have passed all proper parameters.

  • 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-05-22T18:46:20+00:00Added an answer on May 22, 2026 at 6:46 pm

    The Modify parameter is in the INSERT/VALUES parts of your SP – basically they do not match.

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

Sidebar

Related Questions

I have a listview which has its datasource changed after update of a search
I have a uipickerview, which has a dictionary as a datasource. I want to
I have a GridView which is bound to a datasource, which occasionally has a
I have code which performs query on Jboss server. It has JNDI based datasource
I have a GridView which is databound to an XML Datasource. For one of
I have a Clear button which sets the gridview datasource to null and binds
I have a table that has multiple fields which I just need one field.
I have an entity called PendingPartners which has a navigation property to the Residents
I have a table called Shoppings in my SQL db. This one has a
I have a GridView which you can click on a row and it should

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.