QReport中如何实现主从表信息的显示?(100分)

  • 主题发起人 主题发起人 lqg
  • 开始时间 开始时间
L

lqg

Unregistered / Unconfirmed
GUEST, unregistred user!
我的要求本来是在master表中显示 “年份”和“月份”两个字段。在detail表中显示具有和master中的“年份”和“月份”两个字段值相同的所有记录。可是程序运行了以后死活都只是显示一条记录。(master表实现第一条记录,detail表也只是显示第一条记录)。问题出在什么地方呢?
数据库连接是用ADOConnection控件实现的,master表用ADOTable1和DataSource1连接,detail表用ADOTable2连接。ADOTable2的masterSource属性已经设置为DataSource1,
ADOTable2的masterField也已经设置为“年份”和“月份”两个字段两个字段名了。
还有一个问题是:怎么我的delphi7在XP下安装QReport控件组的时候QRChart控件不见了?原来delphi7在win2k下面安装QReport控件组的时候QRChart控件还存在,我还用来写过东西的。大家有没有遇见过这种问题?
下面是我的QReport报表设计的代码。
object QuickRep1: TQuickRep
Functions.Strings = (
'PAGENUMBER'
'COLUMNNUMBER'
'REPORTTITLE')
Functions.DATA = (
'0'
'0'
#39#39)
Options = [FirstPageHeader, LastPageFooter]

object DetailBand1: TQRBand
BandType = rbDetail
end
object QRSubDetail1: TQRSubDetail
Master = QuickRep1
end
object QRBand1: TQRBand
BandType = rbTitle
object QRDBText1: TQRDBText
DataSet = ADOTable1
DataField = 'ID'
end
end
object ChildBand1: TQRChildBand
ParentBand = QRBand1
end
object ChildBand2: TQRChildBand
ParentBand = DetailBand1

object QRDBText2: TQRDBText
DataSet = ADOTable2
DataField ='ID'
end
object QRDBText3: TQRDBText
DataSet = ADOTable2
DataField = #20135#21697'ID'
end
object QRDBText4: TQRDBText
DataSet = ADOTable2
DataField = #21333#20215
end
end
end
object ADOConnection1: TADOConnection
Connected = True
ConnectionString =
'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/Program Files/Mi' +
'crosoft Office/OFFICE11/SAMPLES/Northwind.mdb;Persist Security I' +
'nfo=False'
Mode = cmShareDenyNone
Provider = 'Microsoft.Jet.OLEDB.4.0'
end
object ADOTable1: TADOTable
Active = True
Connection = ADOConnection1
CursorType = ctStatic
TableName = #35746#21333
end
object DataSource1: TDataSource
DataSet = ADOTable1
end
object ADOTable2: TADOTable
Active = True
Connection = ADOConnection1
CursorType = ctStatic
IndexFieldNames = #35746#21333'ID'
MasterFields = 年份;月份
MasterSource = DataSource1
TableName = #35746#21333#26126#32454
end
 
后退
顶部