Imports Crystaldecisions.crystalreports.engine Imports Crystaldecisions.reportsource Imports Crystaldecisions.shared Imports Crystaldecisions.windows.forms Public Class Form5 Dim cryRpt As New ReportDocument Dim crtableLogoninfos As New TableLogOnInfos Dim crtableLogoninfo As New TableLogOnInfo Dim crConnectionInfo As New ConnectionInfo Dim CrTables As Tables Dim CrTable As Table Dim doc As New ReportDocument Dim paramFields As New CrystalDecisions.Shared.ParameterFields() Dim paramField As New CrystalDecisions.Shared.ParameterField() Dim discreteVal As New CrystalDecisions.Shared.ParameterDiscreteValue() Dim paramField1 As New CrystalDecisions.Shared.ParameterField() Dim discreteVal1 As New CrystalDecisions.Shared.ParameterDiscreteValue() Dim paramField2 As New CrystalDecisions.Shared.ParameterField() Dim discreteVal2 As New CrystalDecisions.Shared.ParameterDiscreteValue() Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub CrystalReportViewer1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Load cryRpt.Load("C:\sachin\hrreports\hrreports\Leave_bal130912.rpt") cryRpt.SetDatabaseLogon("sa", "admin-123") paramField.ParameterFieldName = "Year" discreteVal.Value = Form4.ComboBox1.SelectedText paramField.CurrentValues.Add(discreteVal) paramFields.Add(paramField) CrystalReportViewer1.ParameterFieldInfo = paramFields paramField1.ParameterFieldName = "Branch" discreteVal1.Value = Form4.ComboBox2.SelectedText paramField1.CurrentValues.Add(discreteVal1) paramFields.Add(paramField1) CrystalReportViewer1.ParameterFieldInfo = paramFields paramField2.ParameterFieldName = "Month" discreteVal2.Value = Form4.ComboBox3.SelectedText paramField2.CurrentValues.Add(discreteVal2) paramFields.Add(paramField2) CrystalReportViewer1.ParameterFieldInfo = paramFields CrystalReportViewer1.ParameterFieldInfo = paramFields CrystalReportViewer1.ParameterFieldInfo = paramFields CrystalReportViewer1.ParameterFieldInfo = paramFields With crConnectionInfo .IntegratedSecurity = True .ServerName = "testvm" .DatabaseName = "unizimhr" .UserID = "sa" .Password = "admin-123" End With CrTables = cryRpt.Database.Tables For Each CrTable In CrTables crtableLogoninfo = CrTable.LogOnInfo crtableLogoninfo.ConnectionInfo = crConnectionInfo CrTable.ApplyLogOnInfo(crtableLogoninfo) Next CrystalReportViewer1.ReportSource = cryRpt CrystalReportViewer1.Refresh() End Sub End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)