Product Documentation

VCL/CLX Developers Guide

Previous Topic

Next Topic

Manage

Manage() provides data management functionality for your application and/or process.

Below is the code for Manage():

procedure TForm1.Manage;

begin

Delete_Records;

Add_Records;

Display_Records;

end;

procedure TForm1.Delete_Records;

begin

try

while TabCustMast.RecordCount > 0 do

begin

TabCustMast.First;

TabCustMast.Delete;

end;

except

on E : ECtError do Application.ShowException(E);

end;

end;

procedure TForm1.Add_Records;

var

i : integer;

begin

try

for i := 1 to 4 do

begin

TabCustMast.Insert;

TabCustMast.FieldByName('cm_custnum').AsString := RecordData[i,1];

TabCustMast.FieldByName('cm_zip').AsString := RecordData[i,2];

TabCustMast.FieldByName('cm_state').AsString := RecordData[i,3];

TabCustMast.FieldByName('cm_rating').AsString := RecordData[i,4];

TabCustMast.FieldByName('cm_name').AsString := RecordData[i,5];

TabCustMast.FieldByName('cm_address').AsString := RecordData[i,6];

TabCustMast.FieldByName('cm_city').AsString := RecordData[i,7];

TabCustMast.Post;

end;

except

on E : ECtError do Application.ShowException(E);

end;

end;

procedure TForm1.Display_Records;

begin

DataSource1.DataSet := TabCustMast;

DBGrid1.DataSource := DataSource1;

end;

TOCIndex