0% found this document useful (0 votes)
46 views1 page

Insert Edit Delete

This document describes how to use standard methods of the Table component to insert, update, and delete records from a database table. It provides code examples to insert a new record by passing data to the InsertRecord method, delete a record by locating it and calling Delete, and update a record by locating it, editing the fields, and posting the changes.

Uploaded by

Marcel Chis
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views1 page

Insert Edit Delete

This document describes how to use standard methods of the Table component to insert, update, and delete records from a database table. It provides code examples to insert a new record by passing data to the InsertRecord method, delete a record by locating it and calling Delete, and update a record by locating it, editing the fields, and posting the changes.

Uploaded by

Marcel Chis
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Insert/Edit/Delete methods

Insert/Edit/Delete methods
This example uses COUNTRY.DB database of DBDEMOS standard alias. To
insert/update/delete record to/of/from database, you may use standard methods of
Table component.
// Insert record
procedure TForm1.Button1Click(Sender: TObject);
begin
Table1.InsertRecord(['A_My_Country',
'A_My_Capital',
'A_My_Continent',
1,
1]);
end;

// Delete record
procedure TForm1.Button2Click(Sender: TObject);
begin
Table1.Locate('NAME', 'A_My_Country', [loPartialKey]);
Table1.Delete;
end;

// Update record
procedure TForm1.Button3Click(Sender: TObject);
begin
with Table1 do
begin
Locate('NAME', 'A_My_Country', [loPartialKey]);
Edit;
FieldByName('NAME').AsString:='A_Your_Country';
Post;
Refresh;
end;
end;

You might also like