Delphi/CB
•  Greatis •  Security •  AppDatabase •  Utilities •  Visual Basic • .NET •  just4fun
Delphi / C++ Builder
Components, utilities and tips for Delphi and C++ Builder developers
Hot Offer
Save your money!
Featured
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

News Tips .NET Software VCL Software Partners  

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;

Related topics
Using SQL query
Insert/Update/Delete using by SQL

For more
Delphi Help

Download source


Our Partner
DevArchive.com
Recommended
just4fun
Useful Resources
Win32.hlp Online
Unix Manual Pages
MegaDetailed.NET
in3steps.com
Newsletters
Subscribe to our news!    Subscribe to our news!


Greatis Software Greatis | Security | AppDatabase | Utilities | Delphi/CB | Visual Basic | .NET | just4fun

Contacts | Add to Favorites | Recommend to a Friend | Privacy Policy | Copyright © 1998-2008 Greatis Software