I want to update an SQL table by checking/unchecking the checkbox in Blazor Maui Hybrid app. No matter what I try, it won't change anything in the SQL table because the function is not being called.Here's the code for the checkbox:
<th><input type="checkbox" checked = "@equipment.IsCheckedOut" onclick="CheckOutEquipment(@equipment);"></th>
Here's the function it calls:
public void CheckOutEquipment(Equipment equipment){ MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder { Server = "localhost", UserID = "root", Password = "password", Database = "demo211", }; MySqlConnection connection = new MySqlConnection(builder.ConnectionString); connection.Open(); string update = $"update Equipment set CheckedOut = 1 where ID={equipment.ID}"; MySqlCommand updateCmd = new MySqlCommand(update,connection); updateCmd.ExecuteNonQuery(); connection.Close();}