0

Update button executes the query, but nothing shows up in my database. Any thoughts as to why?

I've moved it in and out of an UpdatePanel. I've tried with the couple of variations on the variables like @Atty_ID or ?, but I can't seem to get it to work.

When I click the Update button, nothing happens except the page refreshes sometimes.

<asp:UpdatePanel ID="UpdatePanel19" runat="server">
                    <ContentTemplate>
                        <asp:AccessDataSource ID="ChamberLogoDataSource" runat="server" 
                          DataFile="~/App_Data/Attorneys.mdb" 
                          SelectCommand="SELECT ATTORNEYS.CHAMBER FROM ATTORNEYS WHERE ATTY_ID = ?"
                          UpdateCommand="UPDATE ATTORNEYS SET CHAMBER = ? WHERE ATTY_ID = ?">
                          <SelectParameters>
                            <asp:QueryStringParameter Name="ATT_ID" QueryStringField="ATT_ID" />
                          </SelectParameters>
                          <UpdateParameters>
                            <asp:Parameter Name="CHAMBER" />
                            <asp:Parameter Name="ATTY_ID" />                            
                          </UpdateParameters>
                        </asp:AccessDataSource>
                        Add a Chambers logo:<br />
                        <asp:TextBox ID="TextBox2" runat="server" TextMode="MultiLine" Rows="5" Columns="50"></asp:TextBox>
                        <asp:Button ID="UpdateChambersLogoButton" runat="server" Text="Update" OnClick="UpdateLogo" />
                    </ContentTemplate>
                </asp:UpdatePanel>

And here is the code behind:

Protected Sub UpdateLogo(ByVal sender As Object, ByVal e As System.EventArgs)
    ChamberLogoDataSource.Update()
End Sub
Joseph
  • 609
  • 2
  • 12
  • 26
  • What you see is everything related to the textbox... – Joseph Sep 05 '14 at 18:19
  • I see where you are going with this. Hmmm... I just tried putting the AccessDataSource inside my update panel, but that didn't make a difference either. see update question. – Joseph Sep 05 '14 at 19:16

1 Answers1

1

I believe you have your update parameter binding out of order, and that could be causing the update to fail because there are no matches to the WHERE clause.

Reverse the order of the UpdateParameters like below and try it.

<asp:AccessDataSource ID="ChamberLogoDataSource" runat="server" 
                  DataFile="~/App_Data/Attorneys.mdb" 
                  SelectCommand="SELECT ATTORNEYS.CHAMBER FROM ATTORNEYS WHERE ATTY_ID = ?"
                  UpdateCommand="UPDATE ATTORNEYS SET CHAMBER = ? WHERE (ATTY_ID = ?)">
                  <SelectParameters>
                    <asp:QueryStringParameter Name="ATT_ID" QueryStringField="ATT_ID" />
                  </SelectParameters>
                  <UpdateParameters>
                    <asp:Parameter Name="CHAMBER" />
                    <asp:Parameter Name="ATTY_ID" />
                  </UpdateParameters>
                </asp:AccessDataSource>
              <asp:UpdatePanel ID="UpdatePanel19" runat="server">
                <ContentTemplate>
                    Add a Chambers logo:<br />
                    <asp:TextBox ID="TextBox2" runat="server" TextMode="MultiLine" Rows="5" Columns="50"></asp:TextBox>
                    <asp:Button ID="UpdateChambersLogoButton" runat="server" Text="Update" OnClick="UpdateLogo" />
                </ContentTemplate>
              </asp:UpdatePanel>
Nick Zimmerman
  • 1,471
  • 11
  • 11