updating an access database via gridview RRS feed

  • Question

  • User-1507675294 posted

    When I edit the gridview entry and hit update it reloads the page but doesn't update the field.  What am I missing? 


            <asp:AccessDataSource ID="AccessDataSource3" runat="server" DataFile="~/App_Data/db.mdb"
                SelectCommand="SELECT ActionID, [Action] FROM [Action]"
                UpdateCommand="UPDATE [Action] SET [Action] = @Action WHERE [ActionID] = @ActionID">
                    <asp:ControlParameter Name="@Action" Type="String" ControlID="GridView2" PropertyName="SelectedValue" />
                    <asp:ControlParameter Name="@ActionID" Type="Int32" ControlID="GridView2" PropertyName="SelectedValue" />
            <br />
            <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataKeyNames="ActionID"
                DataSourceID="AccessDataSource3" AutoGenerateEditButton="True">
                    <asp:BoundField DataField="ActionID" HeaderText="ActionID" InsertVisible="False"
                        ReadOnly="True" SortExpression="ActionID" />
                    <asp:BoundField DataField="Action" HeaderText="Action" SortExpression="Action" />


    Sunday, June 22, 2008 11:19 AM


  • User-821857111 posted

    Change your UpdateParameters to this:

        <asp:Parameter Name="Action" Type="String" />
        <asp:Parameter Name="ActionID" Type="Int32" />


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, June 22, 2008 1:20 PM