Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB.NET Crystal - Passing Parameters

Status
Not open for further replies.

deborahb

Programmer
Oct 2, 2000
31
US
I am trying to pass parameters in .Net to my Crystal report.
My code compiles fine and runs but I keep getting prompted for the parameters even though I believe I am passing them. When I step through it seems that I cannot even instantiate the Crystal objects.

Dim paramFields As New ParameterFields

When I look a the values under Locals - they always equal "Error: Cannot obtain value"

Any help will be much appreciated. Deborah

Here is the code:

Private Sub Page_InitPage(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.InitPage
Dim MortgageAP As YSI.Mortgage.DataClasses.ysiMortgageap
Dim AmortizationAppClass As YSI.Mortgage.Pages.AppClasses.ysiMortgageDataSet
Dim DataSet As DataSet
Dim GridColumn As YSI.Controls.ysiGridColumn
Dim Code As String
Dim Description As String
Dim Vendor As String
Dim PropertyName As String
Dim OriginalBalance As Double
Dim InterestRate As Double
Dim MaturityDate As Date

' Declare variables needed to pass the parameters
' to the viewer control.
Dim paramFields As New ParameterFields
Dim paramField As New ParameterField
Dim discreteVal As New ParameterDiscreteValue
Dim rangeVal As New ParameterRangeValue

Code = DataUtil.GetString(Request.Params("Code"))
Description = DataUtil.GetString(Request.Params("Description"))
Vendor = DataUtil.GetString(Request.Params("Vendor"))
PropertyName = DataUtil.GetString(Request.Params("PropertyName"))
OriginalBalance = DataUtil.GetDouble(Request.Params("OriginalBalance"))
InterestRate = DataUtil.GetDouble(Request.Params("InterestRate"))
MaturityDate = DataUtil.GetDate(Request.Params("MaturityDate"))

paramField.ParameterFieldName = "PropertyName"
discreteVal.Value = PropertyName
paramField.CurrentValues.Add(discreteVal)

CrystalReportViewer1.ParameterFieldInfo = paramFields

' Instantiate a new instance of the Amortization AppClass.
AmortizationAppClass = New YSI.Mortgage.Pages.AppClasses.ysiMortgageDataSet(SessionKey)

MortgageAP = New YSI.Mortgage.DataClasses.ysiMortgageap(SessionKey)
MortgageAP.Read(4)

' Force the AppClass to return a DataSet's worth of MortgagePayments.
DataSet = AmortizationAppClass.AmortizationDataSet _
(MortgageAP.OriginalBalance, _
Convert.ToInt32(MortgageAP.Frequency), _
MortgageAP.InterestRate, _
MortgageAP.ConstantPayment, _
Convert.ToInt32(MortgageAP.MortgageType), _
MortgageAP.OriginalBalance, _
Convert.ToInt32(MortgageAP.Periods), _
MortgageAP.EscrowAmount(1), _
MortgageAP.EscrowAmount(2), _
MortgageAP.EscrowAmount(3), _
MortgageAP.EscrowAmount(4), _
MortgageAP.BeginDate, _
Convert.ToInt32(MortgageAP.StartMonth), _
Convert.ToInt32(MortgageAP.DayDue), _
MortgageAP.Code)

AmortizationCrystal02 = New AmortizationCrystal02
AmortizationCrystal02.SetDataSource(DataSet)
Me.CrystalReportViewer1.ReportSource = AmortizationCrystal02



Me.TitleBar.Text = "Mortgage Amortization Schedule from DataSet in YSI.Net"

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top