This belongs in VS 2003, CRv9 forum. Sorry ...
I commenced new job & inherited legacy VS 2003 APPL w/ CR that wasn't working. It's crucial that I get the first report working. The APPL works fine.
Initially, there were 2 errors:
- The CrystalReportViewer1 has 'error creating control' in design view.
- When I run the application, the second error 'CrystalDecisions.CrystalReports.Engine.ParameterFieldCurrentValueException: Missing parameter field current value.' pops up in separate window where report should. The application runs with no bugs.
The APPL runs w/o exceptions (traced & used command window). The rpt runs w/o params; however, I need params. The report w/ params was run in CR only with no issue.
After researching the issue(s), this is the synopsis.
I initially tried to generate the rpt in design view. I fixed the ‘error creating control’:
<!--
'makes crv work in design view, but causes method missing issue if create programatically
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="CrystalDecisions.Web" publicKeyToken="692fbea5521e1304" culture="neutral" />
<bindingRedirect oldVersion="9.1.5000.0" newVersion="9.2.3300.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
-->
The CR Viewer is referencing an older assembly which can’t be deleted, so I worked around it.
I don’t know how to format the DataBindings, so that’s a no go. I couldn’t find any material on how to pass anything in (similar to ‘eval’), so …
Since it’s better to do this programmatically, I used this code:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared 'cry rep export options/params/tables
Imports CrystalDecisions.Web.CrystalReportViewerBase 'get or set login/params col
'cry rep
Dim CryRepView As New CrystalDecisions.Web.CrystalReportViewer
Dim CryRepParam As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition
Dim oRpt As CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim xportOptions As New CrystalDecisions.Shared.ExportOptions
Sub createReport()
oSupervisor = CType(Session(Global.ssSupervisor), Supervisor)
'checking for reportProperties object
If Session("reportProperties") Is Nothing Then
oReportP.reportname = Request.QueryString("rn")
Else
oReportP = CType(Session("reportProperties"), ReportProperties)
End If
Select Case oReportP.reportname
'crv works but exposes few cls, programmatic better
Case "CDL_CityDriverList"
'Get login info
Dim CryRepLogin As TableLogOnInfo 'login into cry rep
Dim CryParamFldDef As ParameterFieldDefinition
Dim rpt As New CDL_CityDriverList
For Each CryRepTable As Table In rpt.Database.Tables 'declare/loop @ cry rep tables
CryRepLogin = CryRepTable.LogOnInfo 'col @ login info
CryRepLogin.ConnectionInfo.UserID = ConfigurationSettings.AppSettings("SqlUser") 'reuse
CryRepLogin.ConnectionInfo.Password = ConfigurationSettings.AppSettings("SqlPassword") 'reuse
CryRepTable.ApplyLogOnInfo(CryRepLogin) 'login
'set CryRepParFlds b4 ReportSource; else prompt @ params, init err
Next 'table
Dim pFld As New ParameterField
Dim pFlds As New ParameterFields
Dim pDisVal As New ParameterDiscreteValue
'requestorssn
pFld.ParameterFieldName = "requestorssn"
pDisVal.Value = "ssn"
pFld.CurrentValues.Add(pDisVal)
pFlds.Add(pFld)
'dept
pFld.ParameterFieldName = "dept"
pDisVal.Value = "dept"
pFld.CurrentValues.Add(pDisVal)
pFlds.Add(pFld)
'add
CryRepView.ParameterFieldInfo = pFlds
CryRepView.ReportSource = "C:\Inetpub\wwwroot\CDL\Reports\CDL_SuspendedDriversList.rpt"
'rpt 'pass rep @ crv
Page.FindControl("Form1").Controls.Add(CryRepView) 'add crv @ page
Exit Sub 'avoid reps below
End Sub
The initial & current err is #2 above.
Thank you in advance for prompt professional reply (paid or otherwise).
Edited by maniac - 17 May 2007 at 12:42pm