Avatar of triphen
triphen

asked on 

VB.net Crystal Reports

Hello Experts,

Using VB.net with VS2010 and I am trying to view a report within my form.

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Open in new window



   Dim cryRpt As New ReportDocument
        Dim crParameterFieldDefinitions As ParameterFieldDefinitions
        Dim crParameterFieldDefinition As ParameterFieldDefinition
        Dim crParameterValues As New ParameterValues
        Dim crParameterDiscreteValue As New ParameterDiscreteValue



        cryRpt.Load(Application.StartupPath & "\Reports\SQLTipPool.rpt")


        crParameterDiscreteValue.Value = (MonthCalendar1.SelectionRange.Start.ToString("yyyy-MM-dd"))
        crParameterFieldDefinitions = _
        cryRpt.DataDefinition.ParameterFields
        crParameterFieldDefinition = _
        crParameterFieldDefinitions.Item("StartDate")
        crParameterValues = crParameterFieldDefinition.CurrentValues
        crParameterValues.Clear()
        crParameterValues.Add(crParameterDiscreteValue)
        crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)

        frm_ReportViewer.Show()
        frm_ReportViewer.CrystalReportViewer1.ReportSource = cryRpt

        cryRpt.SetDatabaseLogon("tuser", "pass", "sqlbase", "")

Open in new window


It produces this error....

---------------------------
Crystal Report Windows Forms Viewer
---------------------------
Failed to retrieve data from the database.
Details:  [Database Vendor Code: -141 ]
Failed to retrieve data from the database.
Error in File SQLTipPool {C25FFE57-8519-4A0B-BBAE-E5FBCA4730D0}.rpt:
Failed to retrieve data from the database.
Details:  [Database Vendor Code: -141 ]
---------------------------
OK  
---------------------------

Also, the report is expecting 2 parameters so I need to pass a second parameter, "EndDate". I cant figure out how to do that as well.

Help?
Visual Basic.NETCrystal Reports

Avatar of undefined
Last Comment
triphen
ASKER CERTIFIED SOLUTION
Avatar of triphen
triphen

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Visual Basic.NET
Visual Basic.NET

Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to Visual Basic pre-2002, it is not the same technology,

96K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo