vb.net - 成功过滤其他记录后如何从水晶视图中删除选择公式以查看所有记录
问题描述
我有两个带有不同表格的水晶报告(PatientBiodataReport.rpt 和 StaffBiodataReport.rpt),我有一个搜索框(文本框)来过滤这两个报告并将结果返回给 CrystalReportViewer1,还有一个按钮来返回所有记录(查看全部).. . 所以在 PatientBiodataReport.rpt 中成功搜索到患者后,如果我决定更改控制返回 StaffBiodataReport.rpt 中的所有记录,但会提示错误,表明之前从 PatientBiodata 中的选择公式仍在使用中,将更改 CrystalReportViewer1。 ReportSource 到 StaffBiodataReport。 请问如何去掉之前水晶报表的选择公式
>>这些是搜索按钮的代码<<
Private Sub searchbtn_Click(sender As Object, e As EventArgs) Handles searchbtn.Click
If Biodatasearchtxt.Text <> "" Then
If GroupBox1.Text = "Patient Biodata Reports Controls" Then
CrystalReportViewer1.ReportSource = Application.StartupPath + "\Reports\PatientBiodataReport.rpt"
CrystalReportViewer1.SelectionFormula = "{patient_biodata.healthcare_no}='" & Biodatasearchtxt.Text.ToString() & "'"
Else
CrystalReportViewer1.ReportSource = Application.StartupPath + "\Reports\StaffBiodataReport.rpt"
CrystalReportViewer1.SelectionFormula = "{staff_biodata.employee_id}='" & Biodatasearchtxt.Text.ToString() & "'"
End If
Else
MsgBox("Please Enter the Search criteria", MsgBoxStyle.Critical)
End If
End Sub
>>这些是查看全部按钮的代码<<
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
With CrystalReportViewer1
If GroupBox1.Text = "Patient Biodata Reports Controls" Then
CrystalReportViewer1.ReportSource = Application.StartupPath + "\Reports\PatientBiodataReport.rpt"
Else
CrystalReportViewer1.ReportSource = Application.StartupPath + "\Reports\StaffBiodataReport.rpt"
End If
End With
End Sub
解决方案
在您可能想要使用的第一个代码块中:
Me.CrystalReportViewer1.RefreshReport()
Me.CrystalReportViewer1.Refresh()
每次尝试更改SelectionFormula后
推荐阅读
- php - 使用 PHP 的 React-native 总是返回 NULL
- c# - 如何计算替换字符串的次数?
- bigtable - 如何将表添加到特定的 Bigtable 实例?
- mongodb - Mongodb中的比较运算符
- python-3.x - 从 Azure Cosmos 中选择数据并在 Python 脚本中输出
- delay - 由于算法部分中的延迟运算符导致的错误
- java - 为什么arraylist没有显示在recyclerview中?
- javascript - 一个组件正在将文本类型的受控输入更改为不受控制 - ReactJS
- python - 如何在 python Web 服务客户端中将 HashMap 作为参数传递
- php - 使用 PHP 格式化 API JSON 响应