You can create a function for adding record and a function of Deleting the data. Call these function in one Button Oclick event.
OR
You can create a Stored Procedure where you can write both Adding and Deleting Query.
Please consider this example
This below Stored procedure will insert the data in Companies table. If the same data is available then that record will be deleted first then inserted again in the table. If not found then Data will be inserted only.
CREATE TABLE [dbo].[Companies](
[Id] [int] IDENTITY(1,1) NOT NULL,
[CompanyName] [varchar](50) NOT NULL,
[Amount] [money] NOT NULL,
CONSTRAINT [PK_Company] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
StoredProcedure
--InsertDeleteCompanies 'A',2000
CREATE PROCEDURE InsertDeleteCompanies
@CompanyName VARCHAR(20)
,@Amount MONEY
AS
BEGIN
SET NOCOUNT ON;
IF EXISTS(SELECT [CompanyName] FROM [Companies] WHERE [CompanyName] = @CompanyName )
BEGIN
DELETE FROM [Companies] WHERE [CompanyName] = @CompanyName
END
INSERT INTO [Companies]
([CompanyName]
,[Amount])
VALUES
(@CompanyName
,@Amount)
END
GO