Delphi Tips&Tricks News   Tips   .NET Software   VCL Software   Search   Contacts
Special Offer!

Ultimate Pack  hot!
Image Editor  new!
Runtime Fusion
Form Designer
Object Inspector
Print Suite Pro
Commented Image
Delphi Toys
WinDowse
Delphi Bonus
TMS Scripter Studio
Form Designer VB
Form Designer .NET

...get more...
for Delphi.NET, C#, VB.NET
for Delphi VCL, BCB 3-6

WinAPI Online
Unix Manual Pages
MegaDetailed.NET
in3steps.com

Blogspot  greatis.blogspot.com

 See more ads about delphi programming →


Insert/Edit/Delete methods - Databases - Tips & Tricks - Greatis Delphi Pages

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;
Related topics
Using SQL query
Insert/Update/Delete using by SQL

For more
Delphi Help

Download source


 See more ads about delphi components →