将参数传递给子报表到水晶报表,WINDOWS APPLICATION [英] passing parameter to a sub report into a crystal report, WINDOWS APPLICATION

查看:82
本文介绍了将参数传递给子报表到水晶报表,WINDOWS APPLICATION的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将参数传递到水晶报表中的子报表中。注意它是一个windosw appliacation ..到目前为止我的代码看起来像(但是当我启动应用程序时它仍然需要用户的参数。





I need to pas parameters into a subreport in crystal report. ATTENTION its a windosw appliacation.. My code so far looks like ( BUT when i start the application it still requires the paramters from the user.


Dim r As New rptMain '--this is the crystal report (main)
          r.SetDataSource(dsMain.Tables(0))


          Dim rr As New rptSub '-- this is the subreport 
          r.Subreports(0).SetDataSource(dsDetal)

          CrystalReportViewer1.ReportSource = r

推荐答案

Dim r As New rptMain '--this is the crystal report (main)
          r.SetDataSource(dsMain.Tables(0))


          Dim rr As New rptSub '-- this is the subreport
          r.Subreports(0).SetDataSource(dsDetal.Tables(0))

          CrystalReportViewer1.ReportSource = r





当向子报告添加.Tables(0)时,它可以...... - - >这行r.Subreports(0).SetDataSource(dsDetal.Tables(0))

之前它是

r.Subreports(0).SetDataSource(dsDetal)



When a add .Tables(0) to the subreport it is ok... ---> This line r.Subreports(0).SetDataSource(dsDetal.Tables(0))
previously it was
r.Subreports(0).SetDataSource(dsDetal)


这是正确的,所以你没有将任何参数传递给子报告。

Rightfully so you did not pass any parameter to the subreport.
Dim r As New rptMain '--this is the crystal report (main)
          r.SetDataSource(dsMain.Tables(0))


          Dim rr As New rptSub '-- this is the subreport
          r.Subreports(0).SetDataSource(dsDetal)
         
' Assuming your parameter is named p1 and you want to pass the value "hello" to it
' the parameter is named helloparameter
         Dim PFlds As New ParameterFields() 
         Dim PFld As New ParameterField("helloparameter") ' changed here
         Dim PVal As New ParameterDiscreteValue()
         PVal.Value = "hello"
         PFld.CurrentValues.Add(PVal) 
         PFlds.Add(PFld)
         CrystalReportViewer1.ReportSource = r
         CrystalReportViewer1.ParameterFieldsInfo = PFlds


这篇关于将参数传递给子报表到水晶报表,WINDOWS APPLICATION的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆