Dynamic create TfrxDBdataset issue
hi
I designed a report by fastreport 5 , dynamic Create Tfrxreport ,TfrxDBdataset ,TFDmemtable(firedac) and found a problem with TfrxDBDataset ,
this TFrxDbdataset's data doesnt refresh ,always same data in it ,TFDmemtable's data is normal
below is code :
var
i, j: integer;
lTable: TFDMemTable;
lSource: TFDMemTable;
aDBset: TfrxDBDataset;
lCountSetName, lFieldName, lResultFieldName: string;
frxpt : TfrxReport ;
begin
frxpt := TfrxReport.create(nil) ;
frxpt.datasets.clear ;
frxpt.loadfilefrom('xxx.fr3');
for i := 0 to lSource.RecordCount - 1 do
begin
lTable := TFDMemTable.Create(nil);
lTable := (CreateSchemaTable('CNTMB')); //
if not Assigned(aTable) then
begin
MessageBox(0, 'create schema fail', 'warn', 48);
exit;
end;
lTable.Open;
lCountSetName := 'SN' + lSource.FieldByName('MB001').AsString;
lTable.Insert;
for j := 0 to lTable.FieldDefs.Count - 1 do
begin
begin
lFieldName := lTable.Fields[j].DisplayName;
lResultFieldName := lSource.Fields[j].DisplayName;
lTable.FieldByName(lFieldName).AsString := lSource.FieldByName(lResultFieldName).AsString;
end;
end;
lTable.Post;
lTable.Open;
aDBset := TfrxDBDataset.Create(nil);
aDBset.UserName := lCountSetName;
aDBset.DataSet := lTable;
frxpt.DataSets.Add(aDBset);
lSource.Next;
end;
frxpt.showreport
plz help ,thanks
I designed a report by fastreport 5 , dynamic Create Tfrxreport ,TfrxDBdataset ,TFDmemtable(firedac) and found a problem with TfrxDBDataset ,
this TFrxDbdataset's data doesnt refresh ,always same data in it ,TFDmemtable's data is normal
below is code :
var
i, j: integer;
lTable: TFDMemTable;
lSource: TFDMemTable;
aDBset: TfrxDBDataset;
lCountSetName, lFieldName, lResultFieldName: string;
frxpt : TfrxReport ;
begin
frxpt := TfrxReport.create(nil) ;
frxpt.datasets.clear ;
frxpt.loadfilefrom('xxx.fr3');
for i := 0 to lSource.RecordCount - 1 do
begin
lTable := TFDMemTable.Create(nil);
lTable := (CreateSchemaTable('CNTMB')); //
if not Assigned(aTable) then
begin
MessageBox(0, 'create schema fail', 'warn', 48);
exit;
end;
lTable.Open;
lCountSetName := 'SN' + lSource.FieldByName('MB001').AsString;
lTable.Insert;
for j := 0 to lTable.FieldDefs.Count - 1 do
begin
begin
lFieldName := lTable.Fields[j].DisplayName;
lResultFieldName := lSource.Fields[j].DisplayName;
lTable.FieldByName(lFieldName).AsString := lSource.FieldByName(lResultFieldName).AsString;
end;
end;
lTable.Post;
lTable.Open;
aDBset := TfrxDBDataset.Create(nil);
aDBset.UserName := lCountSetName;
aDBset.DataSet := lTable;
frxpt.DataSets.Add(aDBset);
lSource.Next;
end;
frxpt.showreport
plz help ,thanks
Comments