Click here to Skip to main content
15,892,965 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have to create crystal report dynamically by using ParameterFields - In that a single parameter have to sent multiple values from MySQL database dynamically. Now I sending multiple values to crystal report from MySql database static and single. I need to sent particular row(dynamically) from MySQL database.

What I have tried:

VB
Dim sql_Sel As String
    Dim hIssId As Integer = 0
    Dim connectionInfo1 As New ConnectionInfo()
    Dim SqlCon As String = "Data source= *****"
    hIssId = Request.QueryString("patID")
    Try
        CrystLabl.ReportSource = Nothing
        Me.SqlCon.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings("xyz").ConnectionString
        Me.SqlCon.Open()
        Dim crystalReport As New ReportDocument()
        sql_Sel = "exec DI_Details @opt=1"
        Dim DA As SqlDataAdapter = New SqlDataAdapter(sql_Sel, SqlCon)
        Dim DG As New DataSet
        DG.DataSetName = "DataSet.xsd"

        DA.Fill(DG, "DataTable1")
        Dim paramFields3 As New CrystalDecisions.Shared.ParameterFields()

        For Each i As String In sql_Sel
            Dim paramField31 As New CrystalDecisions.Shared.ParameterField()
            Dim discreteVal1 As New CrystalDecisions.Shared.ParameterDiscreteValue()
            discreteVal1 = New ParameterDiscreteValue()
            paramField31.ParameterFieldName = "My Parameter"
            discreteVal1.Value = ((DG.Tables(0).Rows(0).Item(1)) & (DG.Tables(0).Rows(0).Item(2)) & (DG.Tables(0).Rows(0).Item(3)) >(DG.Tables(0).Rows(0).Item(6))) 
            paramField31.CurrentValues.Add(discreteVal1)
            paramFields3.Add(paramField31)
        Next

        CrystLabl.ParameterFieldInfo = paramFields3
        CrystLabl.ReportSource = "CrystalReport.rpt"
        CrystLabl.RefreshReport()
    Catch ex As Exception
    Finally
    End Try
End Sub
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900