Passing parameters in Crystal Report
Reply
![]() |
|
From:
![]() AsslamBasha
|
Dear Users..
I created a report containing three parameter fields like "EmpID",and two dates as two parametersik with Crystal Report in .NET." through parameter field. When iam trying to run this Project iam getting error like
"CrystalDecisions.CrystalReports.Engine.ParameterFieldCurrentValueException: Missing parameter field current value."
Here iam pasting my code.
Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared Imports System.Data Imports System.Data.SqlClient
Imports System.IO Imports MTMS.MTMSGlobal
Public Class ReportbyAllSites Inherits System.Web.UI.Page Protected WithEvents CrystalReportViewer1 As CrystalDecisions.Web.CrystalReportViewer Dim Conn As New SqlConnection(connectionString)
'Dim rpt As New rptAllSites() 'Dim rpt As New NewlyReport() Dim repDoc As New AllSitesLocReport() 'Dim subRepDoc As New ReportDocument()
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. 'InitializeComponent() 'CrystalReportViewer1.DataBind() End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here Dim crSections As Sections Dim crSection As Section Dim crReportObjects As ReportObjects Dim crReportObject As ReportObject 'Dim crSubreportObject As SubreportObject Dim crDatabase As Database Dim crTables As Tables Dim crTable As Table Dim crLogOnInfo As TableLogOnInfo Dim crConnInfo As New ConnectionInfo() crDatabase = repDoc.Database crTables = crDatabase.Tables crSections = repDoc.ReportDefinition.Sections For Each crTable In crTables With crConnInfo .ServerName = "ServerName" .DatabaseName = "DBNAME" .UserID = "Userid" .Password = "Password" End With crLogOnInfo = crTable.LogOnInfo crLogOnInfo.ConnectionInfo = crConnInfo crTable.ApplyLogOnInfo(crLogOnInfo) Next For Each crSection In crSections crReportObjects = crSection.ReportObjects For Each crReportObject In crReportObjects
For Each crTable In crTables With crConnInfo .ServerName = "ServerName" .DatabaseName = "DBNAME" .UserID = "Userid" .Password = "Password" End With crLogOnInfo = crTable.LogOnInfo crLogOnInfo.ConnectionInfo = crConnInfo crTable.ApplyLogOnInfo(crLogOnInfo) Next
Next Next
CrystalReportViewer1.ReportSource = repDoc Call setReportParameters() End Sub Private Sub setReportParameters()
Dim paramfields As New ParameterFields()
Dim LocationId As New ParameterField() Dim StartDate As New ParameterField() Dim EndDate As New ParameterField()
Dim sdate As Date Dim edate As Date
sdate = Session("StartDate") edate = Session("EndDate") 'LocationId.pr LocationId.ParameterFieldName = Session("LocationId") StartDate.ParameterFieldName = sdate EndDate.ParameterFieldName = edate
Dim dcLocationId As New ParameterDiscreteValue() Dim dcStartDate As New ParameterDiscreteValue() Dim dcEnddate As New ParameterDiscreteValue()
'Dim sdcLocationId As New sto dcLocationId.Value = Session("LocationId") dcStartDate.Value = sdate dcEnddate.Value = edate
LocationId.CurrentValues.Add(dcLocationId) StartDate.CurrentValues.Add(dcStartDate) EndDate.CurrentValues.Add(dcEnddate)
paramfields.Add(LocationId) paramfields.Add(StartDate) paramfields.Add(EndDate)
CrystalReportViewer1.ParameterFieldInfo = paramfields
End Sub
End Class
Can anyone help for me.. Please tell me some way out! It's really URRRRRGENT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !. Regards Asslam
_________________________________________________________________ Buzz on your screen! Download on your screen. http://www.msn.co.in/Download/screensaver/ Keep yourself smiling!
|
|
View other groups in this category.
![]() |
To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.
Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.
If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.
|
|