vb.net 导出时水晶报表缺少参数值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26007160/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Crystal report missing parameter values when export
提问by Lionel Koh
When I ran my crystal report, I run into an error where its shows missing parameter values
当我运行我的水晶报告时,我遇到了一个错误,其中显示缺少参数值
Below is my code
下面是我的代码
_crAdviceRpt.Load("C:\Users\whatever\AD_AdviceTemplate.rpt")
Dim ds As ADDataset = New ADDataset
Dim dt As DataTable = ds.Tables.Add("ADDatatable")
dt.Columns.Add(New DataColumn("strLinesList", Type.GetType("System.String")))
Dim dr As DataRow
dr = dt.NewRow
dr("strLinesList") = strLine
dt.Rows.Add(dr)
_crAdviceRpt.SetDataSource(ds.Tables(1))
CrDiskFileDestinationOptions.DiskFileName = "location.pdf"
CrExportOptions = _crAdviceRpt.ExportOptions
With CrExportOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
.DestinationOptions = CrDiskFileDestinationOptions
.FormatOptions = CrFormatTypeOptions
End With
_crAdviceRpt.Export()
If Not _crAdviceRpt Is Nothing Then
_crAdviceRpt.Close()
_crAdviceRpt.Dispose()
_crAdviceRpt = Nothing
End If
In my dataset, it does like this: ADDDataset.xsd-> ADDatatable -> strLinesList strLinesList is my column over here
在我的数据集中,它是这样的:ADDDataset.xsd-> ADDatatable -> strLinesList strLinesList 是我的专栏在这里
In crystal report designer, I drag the strLinesList over to my .rpt
在水晶报表设计器中,我将 strLinesList 拖到我的 .rpt
I'm not sure what is wrong but I'm pretty sure that something is missing in my code, so anyhere is appreciated
我不确定出了什么问题,但我很确定我的代码中缺少某些内容,因此不胜感激
回答by Syed Farjad Zia Zaidi
The Solution for this is to reorder the Crystal Parameters to match the Query Prompts
解决方案是重新排序 Crystal 参数以匹配查询提示
1) Open the problem report in Crystal Designer 2) Right click the Parameters section and select reorder parameters 3) Set the Parameter order to match that of the Prompts in the query 4) save the report and retest
1) 在 Crystal Designer 中打开问题报告 2) 右键单击参数部分并选择重新排序参数 3) 设置参数顺序以匹配查询中的提示 4) 保存报告并重新测试
The Verify Database command on the Database menu checks the alias pointers stored in a report file to verify that the database files expected are located in the indicated directories. If the databases are not found in the specified location, the program notifies you of the discrepancies.
“数据库”菜单上的“验证数据库”命令检查存储在报告文件中的别名指针,以验证预期的数据库文件是否位于指定的目录中。如果在指定位置找不到数据库,程序会通知您存在差异。
Using the Verify Database process
使用验证数据库过程
When you choose Verify Database from the Database menu, the program checks the active databases and reports. If it detects changes, the report must be adapted to prevent errors. The program displays the Map Fields dialog box when it detects either of these types of changes to the database: - The name of a database field that is used in the report has changed - The database has been upsized from a PC data source to an SQL data source.
当您从“数据库”菜单中选择“验证数据库”时,程序将检查活动数据库和报告。如果它检测到更改,则必须调整报告以防止错误。当程序检测到数据库发生以下任一类型的更改时,程序会显示“映射字段”对话框: - 报告中使用的数据库字段的名称已更改 - 数据库已从 PC 数据源升级为 SQL数据源。
Crystal Reports automatically adapts the report (and does not display the Map Fields dialog box) if it detects any of these changes: - Fields have been added to the database - Fields that are not used in the report have been deleted from the database - Field positions have changed in the database - Data types have changed for fields in the database.
如果 Crystal Reports 检测到以下任何更改,则它会自动调整报表(并且不显示“映射字段”对话框): - 字段已添加到数据库中 - 报表中未使用的字段已从数据库中删除 - 字段数据库中的位置已更改 - 数据库中字段的数据类型已更改。
Using the Verify on Every Print process
在每次打印过程中使用验证
Verify on Every Print triggers the Verify Database command every time you print your report. - If there is a check mark beside Verify on Every Print, the option is active. It triggers Verify Database every time you print. - If there is no check mark beside it, the option is inactive. The option is inactive by default.
每次打印时验证都会在您每次打印报告时触发验证数据库命令。- 如果在每次打印时验证旁边有一个复选标记,则该选项处于活动状态。每次打印时都会触发验证数据库。- 如果旁边没有复选标记,则该选项无效。该选项默认处于非活动状态。

