Pages

Search This Blog

Thursday, June 21, 2007

VB:Sample code to run Crystal Report

Private Sub frmReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim paramFields As New ParameterFields
Dim paramField As New ParameterField
Dim discreteVal As New ParameterDiscreteValue

paramField.ParameterFieldName = "abc"
discreteVal.Value = "Wavetech"
paramField.CurrentValues.Add(discreteVal)
paramFields.Add(paramField)
paramField = New ParameterField
discreteVal = New ParameterDiscreteValue
paramField.ParameterFieldName = "def"
discreteVal.Value = "Pvt Ltd"
paramField.CurrentValues.Add(discreteVal)
paramFields.Add(paramField)
CRV.ParameterFieldInfo = paramFields
a = New DatabaseConnection
a.CreateConnection()
' ds = a.ExecuteSelect("Select * from employee where id=1", "Employee")
' CRV = ds

CRV.SelectionFormula = "{Fixed.ID}=1" 'Selection Formula
CRV.ReportSource = "Report1.rpt"


End Sub

No comments: