给你个例子:
procedure MyDbCreate_Save;
var
c1: TClientDataSet;
begin
c1 := TClientDataSet.Create(nil);
try
with c1 do
begin
with FieldDefs.AddFieldDef do
begin
Name := '编号';
DataType := ftInteger;
end;
with FieldDefs.AddFieldDef do
begin
Name := '内容';
DataType := ftString;
size := 255;
end;
CreateDataSet;
//*****************************************
追加、处理数据
procedure MyDbLoad_Modify_Save;
var
c1: TClientDataSet;
begin
c1 := TClientDataSet.Create(nil);
try
with c1 do
begin
LoadFromFile('a:/MyData.cds');
//*****************************************
修改、处理数据