Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. vb.net pass paraqmeters to crystal reports

vb.net pass paraqmeters to crystal reports

Scheduled Pinned Locked Moved Visual Basic
csharpdatabasehelptutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jazzgirl
    wrote on last edited by
    #1

    How should I pass 2 parameters from a vb.net 2005 windows application to a crystal report that is written in version 11? I am working on a Visual Basic.NET 2005 windows application. This application needs to call an existing crystal report written in version 11 and needs to pass two (2) parameters to the crystal report. When I step though the code I think I am passing the first parameter, and I know that I am not passing the second parameter. I am getting an error message on the second when I step though the code. My code is basically the following (except I do not know how to code the second parameter) mports CrystalDecisions.Shared Imports CrystalDecisions.ReportSource Imports CrystalDecisions.Windows.Forms Imports System.Data.SqlClient Public Class vbCls Dim cryRpt As New ReportDocument Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim cryRpt As New ReportDocument Dim sql As String Dim connetionString As String Dim connection As SqlConnection Dim adapter As SqlDataAdapter Dim ds As New DataSet Dim i As Integer 'located crystal report from Dim strReportPath As String = "C:\TstReport.rpt" connetionString = "Data Source=server3;Initial Catalog=ProgTest;User ID=xxx;Password=xxxx" connection = New SqlConnection(connetionString) sql = "select * from test_table" Try connection.Open() adapter = New SqlDataAdapter(sql, connection) adapter.Fill(ds) connection.Close() cryRpt.Load(strReportPath) Dim crParameterFieldDefinitions As ParameterFieldDefinitions Dim crParameterFieldDefinition As ParameterFieldDefinition Dim crParameterValues As New ParameterValues Dim crParameterDiscreteValue As New ParameterDiscreteValue crParameterDiscreteValue.Value = 12345 crParameterFieldDefinitions = _ cryRpt.DataDefinition.ParameterFields crParameterFieldDefinition = _ crParameterFieldDefinitions.Item("@Id") crParameterValues = crParameterFieldDefinition.CurrentValues crParameterValues.Clear() crParameterValues.Add(crParameterD

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups