在做一个查询打印的时候,查询的结果明明有14项记录,而用rave打印出来却没有14项记录,出现缺少记录项的情况,但到底是什么原因,请各位帮帮忙!! RvProject1.Open;
RvDataSetConnection1.DataSet := ADOTable2;
MyDataView := RvProject1.projMan.newDataObject(TRaveDataView) as TRaveDataView;
MYDataView.ConnectionName := 'RvDataSetConnection1';
MyDataView.FullName := 'dataview1'; with RvProject1.ProjMan do
begin
MyPage := FindRaveComponent('Report1.page1',nil) as TRavePage;
MyRegion := FindRaveComponent('Region1',Mypage) as TRaveRegion;
MyBand := FindRaveComponent('Band1',Mypage) as TRaveBand;
MyDataband := FindRaveComponent('DataBand1',MyPage) as TRaveDataBand;
MyDataband.DataView := MyDataView;
mytext := findravecomponent('text1',mypage) as TRaveText; //showmessage(inttostr(ADOTable2.RecordCount)); 此处显示的记录个数与打印出来的个数结果相符,但与表中记录个数不符,为什么?
for n := 0 to Rvdatasetconnection1.DataSet.Fields.Count -1 do
begin
a := rvdatasetconnection1.DataSet.Fields.Fields[n].DataType;
if a = ftwidestring then
begin
myfield := TRaveStringfield.Create(mydataview);
myfield.Parent := mydataview;
myfield.FieldName := rvdatasetconnection1.DataSet.Fields.Fields[n].FieldName;
myfield.FullName := rvdatasetconnection1.DataSet.Fields.Fields[n].FieldName;
myfield.AsString;
addcomponent(myfield);
end;
if a = ftfloat then
begin
myfield1 := TRavefloatfield.Create(mydataview);
myfield1.Parent := mydataview;
myfield1.FieldName := rvdatasetconnection1.DataSet.Fields.Fields[n].FieldName;
myfield1.FullName := rvdatasetconnection1.DataSet.Fields.Fields[n].FieldName;
myfield1.AsString;
addcomponent(myfield1);
end;
mydatatext := findravecomponent('datatext'+inttostr(n+2),mypage) as TRavedatatext;
mydatatext.DataView := mydataview;
mydatatext.DataField := rvdatasetconnection1.DataSet.Fields.Fields[n].FieldName;
end;
rvproject1.Execute;
rvproject1.Close;
end;
RvDataSetConnection1.DataSet := ADOTable2;
MyDataView := RvProject1.projMan.newDataObject(TRaveDataView) as TRaveDataView;
MYDataView.ConnectionName := 'RvDataSetConnection1';
MyDataView.FullName := 'dataview1'; with RvProject1.ProjMan do
begin
MyPage := FindRaveComponent('Report1.page1',nil) as TRavePage;
MyRegion := FindRaveComponent('Region1',Mypage) as TRaveRegion;
MyBand := FindRaveComponent('Band1',Mypage) as TRaveBand;
MyDataband := FindRaveComponent('DataBand1',MyPage) as TRaveDataBand;
MyDataband.DataView := MyDataView;
mytext := findravecomponent('text1',mypage) as TRaveText; //showmessage(inttostr(ADOTable2.RecordCount)); 此处显示的记录个数与打印出来的个数结果相符,但与表中记录个数不符,为什么?
for n := 0 to Rvdatasetconnection1.DataSet.Fields.Count -1 do
begin
a := rvdatasetconnection1.DataSet.Fields.Fields[n].DataType;
if a = ftwidestring then
begin
myfield := TRaveStringfield.Create(mydataview);
myfield.Parent := mydataview;
myfield.FieldName := rvdatasetconnection1.DataSet.Fields.Fields[n].FieldName;
myfield.FullName := rvdatasetconnection1.DataSet.Fields.Fields[n].FieldName;
myfield.AsString;
addcomponent(myfield);
end;
if a = ftfloat then
begin
myfield1 := TRavefloatfield.Create(mydataview);
myfield1.Parent := mydataview;
myfield1.FieldName := rvdatasetconnection1.DataSet.Fields.Fields[n].FieldName;
myfield1.FullName := rvdatasetconnection1.DataSet.Fields.Fields[n].FieldName;
myfield1.AsString;
addcomponent(myfield1);
end;
mydatatext := findravecomponent('datatext'+inttostr(n+2),mypage) as TRavedatatext;
mydatatext.DataView := mydataview;
mydatatext.DataField := rvdatasetconnection1.DataSet.Fields.Fields[n].FieldName;
end;
rvproject1.Execute;
rvproject1.Close;
end;
实在不行,就静态的设计一个报表,看还会出现问题么,如果没问题,那就是你上面的那一串代码右问题,可能是因为某个条件筛选到了几条吧。