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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:34:54+00:00 2026-05-25T22:34:54+00:00

i have a webform with a gridview. i have the UPDATE button next to

  • 0

i have a webform with a gridview. i have the UPDATE button next to each row. however when i press the button and edit the field and press UPDATE. it does not change anything. here’s the code:

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
    AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
    DataKeyNames="lom_number" DataSourceID="SqlDataSource1" ForeColor="#333333" 
    GridLines="None" onselectedindexchanged="GridView1_SelectedIndexChanged">
    <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
    <Columns>
        <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
            ShowSelectButton="True" />

        <asp:BoundField DataField="occurrence_date" HeaderText="occurrence_date" 
            SortExpression="occurrence_date" />
        <asp:BoundField DataField="report_date" HeaderText="report_date" 
            SortExpression="report_date" />
        <asp:BoundField DataField="report_by" HeaderText="report_by" 
            SortExpression="report_by" />
        <asp:BoundField DataField="identified_by" HeaderText="identified_by" 
            SortExpression="identified_by" />
        <asp:BoundField DataField="section_c_issue_error_identified_by" 
            HeaderText="section_c_issue_error_identified_by" 
            SortExpression="section_c_issue_error_identified_by" />
        <asp:BoundField DataField="section_c_comments" HeaderText="section_c_comments" 
            SortExpression="section_c_comments" />
        <asp:BoundField DataField="section_d_investigation" 
            HeaderText="section_d_investigation" SortExpression="section_d_investigation" />
        <asp:BoundField DataField="section_e_corrective_action" 
            HeaderText="section_e_corrective_action" 
            SortExpression="section_e_corrective_action" />
        <asp:BoundField DataField="section_f_comments" HeaderText="section_f_comments" 
            SortExpression="section_f_comments" />
        <asp:BoundField DataField="pre_practice_code" HeaderText="pre_practice_code" 
            SortExpression="pre_practice_code" />
        <asp:BoundField DataField="pre_contact" HeaderText="pre_contact" 
            SortExpression="pre_contact" />
        <asp:BoundField DataField="lom_number" HeaderText="lom_number" 
            InsertVisible="False" ReadOnly="True" SortExpression="lom_number" />
        <asp:BoundField DataField="windows_user" HeaderText="windows_user" 
            SortExpression="windows_user" />
        <asp:BoundField DataField="computer_name" HeaderText="computer_name" 
            SortExpression="computer_name" />
        <asp:BoundField DataField="time_stamp" HeaderText="time_stamp" 
            SortExpression="time_stamp" />

    </Columns>
    <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
    <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
    <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
    <AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:LOM %>" 
    SelectCommand="SELECT * FROM [Main_LOM_Form]" 
    ConflictDetection="CompareAllValues" 
    DeleteCommand="DELETE FROM [Main_LOM_Form] WHERE [lom_number] = @original_lom_number AND (([occurrence_date] = @original_occurrence_date) OR ([occurrence_date] IS NULL AND @original_occurrence_date IS NULL)) AND (([report_date] = @original_report_date) OR ([report_date] IS NULL AND @original_report_date IS NULL)) AND (([report_by] = @original_report_by) OR ([report_by] IS NULL AND @original_report_by IS NULL)) AND (([identified_by] = @original_identified_by) OR ([identified_by] IS NULL AND @original_identified_by IS NULL)) AND (([section_c_issue_error_identified_by] = @original_section_c_issue_error_identified_by) OR ([section_c_issue_error_identified_by] IS NULL AND @original_section_c_issue_error_identified_by IS NULL)) AND (([section_c_comments] = @original_section_c_comments) OR ([section_c_comments] IS NULL AND @original_section_c_comments IS NULL)) AND (([section_d_investigation] = @original_section_d_investigation) OR ([section_d_investigation] IS NULL AND @original_section_d_investigation IS NULL)) AND (([section_e_corrective_action] = @original_section_e_corrective_action) OR ([section_e_corrective_action] IS NULL AND @original_section_e_corrective_action IS NULL)) AND (([section_f_comments] = @original_section_f_comments) OR ([section_f_comments] IS NULL AND @original_section_f_comments IS NULL)) AND (([pre_practice_code] = @original_pre_practice_code) OR ([pre_practice_code] IS NULL AND @original_pre_practice_code IS NULL)) AND (([pre_contact] = @original_pre_contact) OR ([pre_contact] IS NULL AND @original_pre_contact IS NULL)) AND [windows_user] = @original_windows_user AND [computer_name] = @original_computer_name AND [time_stamp] = @original_time_stamp" 
    InsertCommand="INSERT INTO [Main_LOM_Form] ([occurrence_date], [report_date], [report_by], [identified_by], [section_c_issue_error_identified_by], [section_c_comments], [section_d_investigation], [section_e_corrective_action], [section_f_comments], [pre_practice_code], [pre_contact], [windows_user], [computer_name], [time_stamp]) VALUES (@occurrence_date, @report_date, @report_by, @identified_by, @section_c_issue_error_identified_by, @section_c_comments, @section_d_investigation, @section_e_corrective_action, @section_f_comments, @pre_practice_code, @pre_contact, @windows_user, @computer_name, @time_stamp)" 
    OldValuesParameterFormatString="original_{0}" 
    UpdateCommand="UPDATE [Main_LOM_Form] SET [occurrence_date] = @occurrence_date, [report_date] = @report_date, [report_by] = @report_by, [identified_by] = @identified_by, [section_c_issue_error_identified_by] = @section_c_issue_error_identified_by, [section_c_comments] = @section_c_comments, [section_d_investigation] = @section_d_investigation, [section_e_corrective_action] = @section_e_corrective_action, [section_f_comments] = @section_f_comments, [pre_practice_code] = @pre_practice_code, [pre_contact] = @pre_contact, [windows_user] = @windows_user, [computer_name] = @computer_name, [time_stamp] = @time_stamp WHERE [lom_number] = @original_lom_number AND (([occurrence_date] = @original_occurrence_date) OR ([occurrence_date] IS NULL AND @original_occurrence_date IS NULL)) AND (([report_date] = @original_report_date) OR ([report_date] IS NULL AND @original_report_date IS NULL)) AND (([report_by] = @original_report_by) OR ([report_by] IS NULL AND @original_report_by IS NULL)) AND (([identified_by] = @original_identified_by) OR ([identified_by] IS NULL AND @original_identified_by IS NULL)) AND (([section_c_issue_error_identified_by] = @original_section_c_issue_error_identified_by) OR ([section_c_issue_error_identified_by] IS NULL AND @original_section_c_issue_error_identified_by IS NULL)) AND (([section_c_comments] = @original_section_c_comments) OR ([section_c_comments] IS NULL AND @original_section_c_comments IS NULL)) AND (([section_d_investigation] = @original_section_d_investigation) OR ([section_d_investigation] IS NULL AND @original_section_d_investigation IS NULL)) AND (([section_e_corrective_action] = @original_section_e_corrective_action) OR ([section_e_corrective_action] IS NULL AND @original_section_e_corrective_action IS NULL)) AND (([section_f_comments] = @original_section_f_comments) OR ([section_f_comments] IS NULL AND @original_section_f_comments IS NULL)) AND (([pre_practice_code] = @original_pre_practice_code) OR ([pre_practice_code] IS NULL AND @original_pre_practice_code IS NULL)) AND (([pre_contact] = @original_pre_contact) OR ([pre_contact] IS NULL AND @original_pre_contact IS NULL)) AND [windows_user] = @original_windows_user AND [computer_name] = @original_computer_name AND [time_stamp] = @original_time_stamp">
    <DeleteParameters>
        <asp:Parameter Name="original_lom_number" Type="Int32" />
        <asp:Parameter DbType="Date" Name="original_occurrence_date" />
        <asp:Parameter DbType="Date" Name="original_report_date" />
        <asp:Parameter Name="original_report_by" Type="String" />
        <asp:Parameter Name="original_identified_by" Type="String" />
        <asp:Parameter Name="original_section_c_issue_error_identified_by" 
            Type="String" />
        <asp:Parameter Name="original_section_c_comments" Type="String" />
        <asp:Parameter Name="original_section_d_investigation" Type="String" />
        <asp:Parameter Name="original_section_e_corrective_action" Type="String" />
        <asp:Parameter Name="original_section_f_comments" Type="String" />
        <asp:Parameter Name="original_pre_practice_code" Type="String" />
        <asp:Parameter Name="original_pre_contact" Type="String" />
        <asp:Parameter Name="original_windows_user" Type="String" />
        <asp:Parameter Name="original_computer_name" Type="String" />
        <asp:Parameter Name="original_time_stamp" Type="DateTime" />
    </DeleteParameters>
    <UpdateParameters>
        <asp:Parameter DbType="Date" Name="occurrence_date" />
        <asp:Parameter DbType="Date" Name="report_date" />
        <asp:Parameter Name="report_by" Type="String" />
        <asp:Parameter Name="identified_by" Type="String" />
        <asp:Parameter Name="section_c_issue_error_identified_by" Type="String" />
        <asp:Parameter Name="section_c_comments" Type="String" />
        <asp:Parameter Name="section_d_investigation" Type="String" />
        <asp:Parameter Name="section_e_corrective_action" Type="String" />
        <asp:Parameter Name="section_f_comments" Type="String" />
        <asp:Parameter Name="pre_practice_code" Type="String" />
        <asp:Parameter Name="pre_contact" Type="String" />
        <asp:Parameter Name="windows_user" Type="String" />
        <asp:Parameter Name="computer_name" Type="String" />
        <asp:Parameter Name="time_stamp" Type="DateTime" />
        <asp:Parameter Name="original_lom_number" Type="Int32" />
        <asp:Parameter DbType="Date" Name="original_occurrence_date" />
        <asp:Parameter DbType="Date" Name="original_report_date" />
        <asp:Parameter Name="original_report_by" Type="String" />
        <asp:Parameter Name="original_identified_by" Type="String" />
        <asp:Parameter Name="original_section_c_issue_error_identified_by" 
            Type="String" />
        <asp:Parameter Name="original_section_c_comments" Type="String" />
        <asp:Parameter Name="original_section_d_investigation" Type="String" />
        <asp:Parameter Name="original_section_e_corrective_action" Type="String" />
        <asp:Parameter Name="original_section_f_comments" Type="String" />
        <asp:Parameter Name="original_pre_practice_code" Type="String" />
        <asp:Parameter Name="original_pre_contact" Type="String" />
        <asp:Parameter Name="original_windows_user" Type="String" />
        <asp:Parameter Name="original_computer_name" Type="String" />
        <asp:Parameter Name="original_time_stamp" Type="DateTime" />
    </UpdateParameters>
    <InsertParameters>
        <asp:Parameter DbType="Date" Name="occurrence_date" />
        <asp:Parameter DbType="Date" Name="report_date" />
        <asp:Parameter Name="report_by" Type="String" />
        <asp:Parameter Name="identified_by" Type="String" />
        <asp:Parameter Name="section_c_issue_error_identified_by" Type="String" />
        <asp:Parameter Name="section_c_comments" Type="String" />
        <asp:Parameter Name="section_d_investigation" Type="String" />
        <asp:Parameter Name="section_e_corrective_action" Type="String" />
        <asp:Parameter Name="section_f_comments" Type="String" />
        <asp:Parameter Name="pre_practice_code" Type="String" />
        <asp:Parameter Name="pre_contact" Type="String" />
        <asp:Parameter Name="windows_user" Type="String" />
        <asp:Parameter Name="computer_name" Type="String" />
        <asp:Parameter Name="time_stamp" Type="DateTime" />
    </InsertParameters>
</asp:SqlDataSource>

here is the query that it i intercepted with james’ help:

updateQuery "UPDATE [Main_LOM_Form] SET [occurrence_date] = @occurrence_date, [report_date] = @report_date, [report_by] = @report_by, [identified_by] = @identified_by, [section_c_issue_error_identified_by] = @section_c_issue_error_identified_by, [section_c_comments] = @section_c_comments, [section_d_investigation] = @section_d_investigation, [section_e_corrective_action] = @section_e_corrective_action, [section_f_comments] = @section_f_comments, [pre_practice_code] = @pre_practice_code, [pre_contact] = @pre_contact, [windows_user] = @windows_user, [computer_name] = @computer_name, [time_stamp] = @time_stamp WHERE [lom_number] = @original_lom_number AND (([occurrence_date] = @original_occurrence_date) OR ([occurrence_date] IS NULL AND @original_occurrence_date IS NULL)) AND (([report_date] = @original_report_date) OR ([report_date] IS NULL AND @original_report_date IS NULL)) AND (([report_by] = @original_report_by) OR ([report_by] IS NULL AND @original_report_by IS NULL)) AND (([identified_by] = @original_identified_by) OR ([identified_by] IS NULL AND @original_identified_by IS NULL)) AND (([section_c_issue_error_identified_by] = @original_section_c_issue_error_identified_by) OR ([section_c_issue_error_identified_by] IS NULL AND @original_section_c_issue_error_identified_by IS NULL)) AND (([section_c_comments] = @original_section_c_comments) OR ([section_c_comments] IS NULL AND @original_section_c_comments IS NULL)) AND (([section_d_investigation] = @original_section_d_investigation) OR ([section_d_investigation] IS NULL AND @original_section_d_investigation IS NULL)) AND (([section_e_corrective_action] = @original_section_e_corrective_action) OR ([section_e_corrective_action] IS NULL AND @original_section_e_corrective_action IS NULL)) AND (([section_f_comments] = @original_section_f_comments) OR ([section_f_comments] IS NULL AND @original_section_f_comments IS NULL)) AND (([pre_practice_code] = @original_pre_practice_code) OR ([pre_practice_code] IS NULL AND @original_pre_practice_code IS NULL)) AND (([pre_contact] = @original_pre_contact) OR ([pre_contact] IS NULL AND @original_pre_contact IS NULL)) AND [windows_user] = @original_windows_user AND [computer_name] = @original_computer_name AND [time_stamp] = @original_time_stamp"    string

what am i doing wrong?

  • 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-25T22:34:55+00:00Added an answer on May 25, 2026 at 10:34 pm

    I would suggest adding an OnUpdating event handler so you can look at the CommandText before the query is executed. That should help you identify if there’s an issue with the query.

    In the markup:

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" OnUpdating="SqlDataSource1_Updating" ... >
    

    In the code-behind:

    protected void SqlDataSource1_Updating(object sender, SqlDataSourceCommandEventArgs e)
    {    
        string updateQuery = e.Command.CommandText;
    
        //inspect the update query
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hi i have a very simple webform i have a button and a gridview
I have an ASP.net gridview on a webform where user's can select a row.
I have created a ASP.NET WebForms Gridview and I need to access each row
I have a webform and i want to detect if F5 button was pressed
Well, just to keep it simple: I have a webform. On it a button
I have this exception i have a asp.net gridview with select edit and delete
Greetings, In my current project, I have gridview, search button, text box for search,
I have a webform with a button and a textbox. I want to set
I have a webform gridview. In that one columns is password. I want to
I'm currently stuck. I have a webform with a button that registers or saves

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.