Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
my problem is that when encoding the tenant's payment, the current status is not paid. then I tried to encode the amount of the tenant's payment the status does not change to paid still the status is not paid.

What I have tried:

C#
public void loaddata()
        {
            con.Close();
            DataTable table = new DataTable();
            cmd = new MySqlCommand("SELECT CASE STATUS WHEN 1 THEN 'NOT PAID' ELSE 'PAID' END AS STATUS FROM ledgercard", con.con);
            con.Open();
            reader = cmd.ExecuteReader();
            table.Load(reader);
            dataGridViewPayment.DataSource = table;
            dataGridViewPayment.ReadOnly = true;
            dataGridViewPayment.Columns[0].Visible = false;

            loaddata();

        }
Posted
Updated 21-Sep-22 21:24pm
v4

1 solution

That code doesn't update anything: a SELECT query only ever returns existing data, it doers not modify any data at all.

To change an existing value in a row of a table, you use an UPDATE query: SQL UPDATE Statement[^]
 
Share this answer
 
Comments
Marc Chester Ferrer 22-Sep-22 3:36am    
thank you
OriginalGriff 22-Sep-22 4:20am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900