I'm creating a shopping cart and I wanted to update all the data on gridview which were not Remove.

here is my shopping cart:

enter image description here

private void quotate()
    {
        con.Open();
        cmd = new SqlCommand(@"UPDATE transaction_status
                            SET status_of_transaction = @status_of_transaction
                         WHERE transaction_id = @transaction_id
                            AND transaction_number = @transaction_number
                            ", con);

        cmd.Parameters.AddWithValue("@transaction_id", GridView1.SelectedRow.Cells[1].Text);
        cmd.Parameters.AddWithValue("@transaction_number", GridView1.SelectedRow.Cells[2].Text);

        cmd.Parameters.AddWithValue("@status_of_transaction", "review");


        cmd.ExecuteNonQuery();
        con.Close();
    }

How could I update all remaining data on the table because SelectedRow is not working.

Related posts

Recent Viewed