C#
public static void UpdateCustomerName(Customer customer)
{
string updateName = $"UPDATE client_schedule.customer SET customerName = '{customer.CustomerName}'" +
$"WHERE customerId = {customer.CustomerID}";
DBConnect.StartConnection(); // Starts the connection
try
{
using (DBConnect.Conn)
using (MySqlCommand cmd = new MySqlCommand(updateName, DBConnect.Conn))
{
cmd.ExecuteNonQuery();
}
}
}
catch (MySqlException ex)
{
DBConnect.StopConnection();
MessageBox.Show(ex.Message);
}
DBConnect.StopConnection();
}
C#
public static void UpdateCustomerName(Customer customer)
{
string updateName = $"UPDATE client_schedule.customer SET customerName = '{customer.CustomerName}'" +
$"WHERE customerId = {customer.CustomerID}";
DBConnect.StartConnection(); // Starts the connection
try
{
using (DBConnect.Conn)
using (MySqlCommand cmd = new MySqlCommand(updateName, DBConnect.Conn))
{
cmd.ExecuteNonQuery();
}
}
}
catch (MySqlException ex)
{
DBConnect.StopConnection();
MessageBox.Show(ex.Message);
}
DBConnect.StopConnection();
}