M
maodw76
Unregistered / Unconfirmed
GUEST, unregistred user!
例如创建一个文本文件用ClientDataSet连接它
如
var
FileName:String;
begin
FileName:= ExtractFilePath(Application.ExeName)+'Scheme.cds';
ClientDataSet.FileName :=FileName;
ClientDataSet.FieldDefs.Add('SchemeName',ftString,100);
ClientDataSet.FieldDefs.Add('ID',ftInteger);
//ClientDataSet.FieldDefs.Add('ClName',ftString,20);
ClientDataSet.CreateDataSet;
end;
追加100000条记录
for i:=0 to 100000 do
begin
ClientDataSet.Append;
ClientDataSet.FieldByName('SchemeName').AsString:='Mao';
ClientDataSet.FieldByName('ID').AsInteger:=i;
end;
ClientDataSet.Post;
//ClientDataSet.applyupdates(-1);//执行不过去?
删除记录:
for i:=0 to ClientDataSet.RecordCount -1 do
begin
ClientDataSet.Delete;
ClientDataSet.Next;//
end;
ClientDataSet1.Post;//删除后文件大小不变,之后再对其操作慢到无法忍受,请高手指点!
如
var
FileName:String;
begin
FileName:= ExtractFilePath(Application.ExeName)+'Scheme.cds';
ClientDataSet.FileName :=FileName;
ClientDataSet.FieldDefs.Add('SchemeName',ftString,100);
ClientDataSet.FieldDefs.Add('ID',ftInteger);
//ClientDataSet.FieldDefs.Add('ClName',ftString,20);
ClientDataSet.CreateDataSet;
end;
追加100000条记录
for i:=0 to 100000 do
begin
ClientDataSet.Append;
ClientDataSet.FieldByName('SchemeName').AsString:='Mao';
ClientDataSet.FieldByName('ID').AsInteger:=i;
end;
ClientDataSet.Post;
//ClientDataSet.applyupdates(-1);//执行不过去?
删除记录:
for i:=0 to ClientDataSet.RecordCount -1 do
begin
ClientDataSet.Delete;
ClientDataSet.Next;//
end;
ClientDataSet1.Post;//删除后文件大小不变,之后再对其操作慢到无法忍受,请高手指点!