L
lijun175165721
Unregistered / Unconfirmed
GUEST, unregistred user!
在写了以下代码后:
var
ClientDataSet:TClientDataSet;
i:integer;
begin
ClientDataSet:=TClientDataSet.Create(Application);
ClientDataSet.FieldDefs.Add('Name',ftString,20,false);
ClientDataSet.FieldDefs.Add('Age',ftInteger,0,false);
ClientDataSet.CreateDataSet;
ClientDataSet.Open;
for i:=0 to 1do
begin
ClientDataSet.Append;
ClientDataSet.Fields[0].Value:='Jim'+IntToStr(i);
ClientDataSet.Fields[1].Value:=i;
ClientDataSet.Post;
end;
ClientDataSet.SaveToFile('C:/temp.dat');
ClientDataSet.LoadFromFile('C:/temp.dat');
ClientDataSet.Open;
self.DataSource1.DataSet:=ClientDataSet;
self.DBGrid1.DataSource:=self.DataSource1;
之后怎么用loadFromFile来加载到ClientDataSet呀?
我用这方法的时候老是提示丢失数据!
请大家指点!!!!!
var
ClientDataSet:TClientDataSet;
i:integer;
begin
ClientDataSet:=TClientDataSet.Create(Application);
ClientDataSet.FieldDefs.Add('Name',ftString,20,false);
ClientDataSet.FieldDefs.Add('Age',ftInteger,0,false);
ClientDataSet.CreateDataSet;
ClientDataSet.Open;
for i:=0 to 1do
begin
ClientDataSet.Append;
ClientDataSet.Fields[0].Value:='Jim'+IntToStr(i);
ClientDataSet.Fields[1].Value:=i;
ClientDataSet.Post;
end;
ClientDataSet.SaveToFile('C:/temp.dat');
ClientDataSet.LoadFromFile('C:/temp.dat');
ClientDataSet.Open;
self.DataSource1.DataSet:=ClientDataSet;
self.DBGrid1.DataSource:=self.DataSource1;
之后怎么用loadFromFile来加载到ClientDataSet呀?
我用这方法的时候老是提示丢失数据!
请大家指点!!!!!