Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net Crystal Reports RecordSelectionFormula不起作用_Vb.net_Crystal Reports - Fatal编程技术网

Vb.net Crystal Reports RecordSelectionFormula不起作用

Vb.net Crystal Reports RecordSelectionFormula不起作用,vb.net,crystal-reports,Vb.net,Crystal Reports,这是我的密码: CrystalReportViewer1.Zoom(75) Dim rpt As New CrystalReport1 rpt.RecordSelectionFormula = "{members.id} ='3232'" CrystalReportViewer1.ReportSource = rpt CrystalReportViewer1.Refresh() 它显示了所有的记录,我不知道为什么 Dim CrReport As New CrystalDecisions.Cry

这是我的密码:

CrystalReportViewer1.Zoom(75)
Dim rpt As New CrystalReport1
rpt.RecordSelectionFormula = "{members.id} ='3232'"
CrystalReportViewer1.ReportSource = rpt
CrystalReportViewer1.Refresh()
它显示了所有的记录,我不知道为什么

Dim CrReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument
CrReport = New CrystalDecisions.CrystalReports.Engine.ReportDocument()
CrReport.Load(Application.StartupPath & "\CrystalReport1.rpt")
CrReport.SetDataSource("HERE YOUR DATASET USED IN DA DESIGN OF CRYSTALREPORT1.rpt")
CrystalReportViewer1.ReportSource = CrReport
CrReport.RecordSelectionFormula = "{members.id} ='3232'"

您的CRYSTALREPORT1.rpt必须位于appath的
\\BIN\DEBUG
,并且必须几乎在之前创建。就像Visual Studio中的设计师设计的对象….>添加新项>CR

您必须在Form report(设计视图)中创建CrystalReportDocument,然后,Visual Studio将显示一个窗口,您可以在其中为CrystalReportDocument选择一个类。选择与report.rpt相关的类,然后在打印事件中添加以下内容:

crystalReportDocument.Load(@"reports\report.rpt");

crystalReportDocument.RecordSelectionFormula = "{viewTable.IdTable}=1";

crystalReportDocument.PrintToPrinter(1, false, 0, 0);
viewTable是数据库中的视图元素


许多人习惯于为所有人提供数据集,但在许多情况下这是荒谬的。

报表使用的sql查询是什么?sql查询?RecordSelectionFormula是我使用的唯一公式,我不知道在哪里可以找到您提到的内容。您的rpt对象很可能有一个“SQLQueryString”属性,它保存针对数据库服务器发送的SQL查询。你能查一下这个问题吗?