dotConnect with Crystal Reports, vb.net 2008

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
BWickersheim
Posts: 1
Joined: Thu 02 Apr 2009 21:13

dotConnect with Crystal Reports, vb.net 2008

Post by BWickersheim » Thu 02 Apr 2009 21:29

I am unable to get a crystal report to show any data. I've poured through your samples and many websites and cannot figure it out. I'm new to .NET so that may be the problem. What I'm trying to do is not like your sample. I have a vb.net 2008 windows form application. On many pages there is a Print button which I want to call a form for displaying and printing reports. The form will be generic, will only have a Crystal Report Viewer on it, and the parameters will be passed in. I'm working on getting the first one working, so this isn't generic yet, but if I can get the below working I can expand on it.

The original form will have a Print button like

Code: Select all

Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
        Dim rpt As New frmViewReport()
        rpt.Show()
End Sub
The form frmViewReport has only a Crystal Report Report viewer on it called rptViewer. It has no ReportSource set, as I want to do that in the code.

The data set is called KB (KB.xsd) and is included in the project.

The report is called rptReminders.rpt and is included in the project. Its structure echoes the sql statement below.

I already have a connection the db open called dbKB.

The code for frmViewReport is

Code: Select all

Imports Devart.Data.Oracle
Imports CrystalDecisions.CrystalReports.Engine

Public Class frmViewReport

Private Sub frmViewReport_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim cmd1 As OracleCommand = New OracleCommand()
        cmd1.Connection = dbKB
        cmd1.CommandText = "SELECT SUSPENSE.BAN, SUSPENSEDATE, BILLAC.NAME " & _
            "FROM SUSPENSE, BILLAC WHERE SUSPENSE.BAN=BILLAC.BAN AND USERID = :USERID " & _
            "AND SUSPENSEDATE <= SYSDATE ORDER BY SUSPENSEDATE"
        cmd1.Parameters.AddWithValue("USERID", userInfo.id)
        Dim adp1 As OracleDataAdapter = New OracleDataAdapter(cmd1)
        Dim ds1 As KB = New KB

        adp1.Fill(ds1, "Reminders")

        Dim rpt As rptReminders = New rptReminders
        rpt.SetDataSource(ds1)
        rptViewer.ReportSource = rpt

    End Sub
End Class
When I run this, I get no errors, in fact the Data Set is populated ( I can read through it in the code ) but when the report prints all I get are the column headers. What am I doing wrong? Thank-you,

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 03 Apr 2009 13:00

Could you please send us (support at devart*com, topic "Crystal Reports") a small test project with definitions of your database objects? We will look into this issue.

Post Reply