private void CreateProductOnSlave1Database(Product pro) { string cmd = $"INSERT INTO ARTIKEL(KZPREISAENDERUNG,columnNames) VALUES({pro.KZPREISAENDERUNG},otherValues)"; FbConnection peterConnection = GetSlave1DatabaseConnection(); FbTransaction transaction = peterConnection.BeginTransaction("CreateProductOnSlave1"); FbCommand command = new FbCommand(); command.CommandType = CommandType.Text; command.Connection = peterConnection; command.Transaction = transaction; command.CommandText = cmd; try { command.ExecuteNonQuery(); transaction.Commit(); } catch (Exception message) { transaction.Rollback(); MessageBox.Show(message.Message); } finally { KillDatabaseConnection(peterConnection,command); } }
public void KillDatabaseConnection(FbConnection connection, FbCommand command) { command.Dispose(); connection.Close(); connection.Dispose(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)