您好,我的VS2008项目中有很多水晶报告。
我正在更改几个数据库表,并希望确保对报告进行所有必要的更改。我已经对正在使用的特定存储过程进行了标准VS搜索,但没有找到结果。但是,当我进入报告并查看“选择专家”时,我发现实际上正在使用该过程。
有没有一种方法可以轻松搜索所有报告以查找此过程(和其他过程)?还是我必须检查每个报告并检查?
谢谢,
最佳答案
这是我生成的VB proc的一部分,可生成我的报告使用的所有表的列表。报告在“报告表”中列出,我使用备注字段来存储所有已使用表的名称。一旦修改了表,就很容易更新所有请求的报告。
Public function tablesUsedByAReport(myReportName as string) as string
Dim m_report As CRAXDRT.Report, _
m_crystal As CRAXDRT.Application, _
m_tablesUsedByAReport As String
Dim m_table As CRAXDRT.DatabaseTable, _
m_section As CRAXDRT.section, _
m_objet As Object, _
m_subReport As CRAXDRT.SubreportObject
Set m_crystal = New CRAXDRT.Application
Set m_rapport = m_crystal.OpenReport(m_nomRapport, 1)
'table names in the report'
For Each m_table In m_rapport.Database.tables
m_tablesUsedByAReport = m_tablesUsedByAReport & m_table.location & ";"
Next m_table
'table names in each of the subreports'
For Each m_section In m_rapport.Sections
For Each m_objet In m_section.ReportObjects
If m_objet.Kind = crSubreportObject Then
Set m_subReport = m_objet
Set m_report = m_subReport.OpenSubreport
For Each m_table In m_rapport.Database.tables
m_tablesUsedByAReport = m_tablesUsedByAReport & m_table.location & ";"
Next m_table
End If
Next m_objet
Next m_section
'my tables list'
tablesUsedByAReport = m_tablesUsedByAReport
End function