Solved

SELECT Records for Crystal Report

Posted on 2006-11-23
1
214 Views
Last Modified: 2010-04-23
Hi all,

I am having a problem with record selection for one of my reports.

I am using this code:

Me.Cursor = Cursors.WaitCursor
        Dim crReportDocument As contacten
        Me.Cursor = Cursors.WaitCursor
        Dim sqlString As String = "Select * From tblcontacten where organisatie = 'Scholen'"
        adapt = New OleDb.OleDbDataAdapter(sqlString, conn)
        Dim rp As DataSet = New DataSet()
        adapt.Fill(rp, "contacten")
        crReportDocument = New contacten
        crReportDocument.SetDataSource(rp)
        crvw2.ShowPrintButton = True
        crvw2.ShowExportButton = False
        crvw2.ShowGroupTreeButton = False
        crvw2.ReportSource = crReportDocument
        crvw2.ShowPageNavigateButtons = False
        crvw2.Zoom(80)
        Me.Cursor = Cursors.Default

but this always returns every record, no selectionis made

However, I am using the same code for another report:

Dim crReportDocument As kassa
        Dim kas As String = ComboBox2.Text
        crvw1.Visible = True
        Me.Cursor = Cursors.WaitCursor
        Dim sqlString As String = "Select * From " & kas & " where debet<>0"
        adapt = New OleDb.OleDbDataAdapter(sqlString, conn)
        ds = New DataSet()
        adapt.Fill(ds, "kassa")
        crReportDocument = New kassa
        crReportDocument.SetDataSource(ds)
        crvw1.ShowPrintButton = True
        crvw1.ShowExportButton = False
        crvw1.ShowGroupTreeButton = False
        crvw1.ReportSource = crReportDocument
        crvw1.ShowPageNavigateButtons = False
        crvw1.Zoom(80)
        Me.Cursor = Cursors.Default

and this works fine.

I have restarted creating the report 3 times, thinking there was something I had done differently, but that did'nt help.
I have verified the SQL in the database, this returns a selection of records.

Suggestions?
0
Comment
Question by:JamesBrian
1 Comment
 
LVL 21

Accepted Solution

by:
theGhost_k8 earned 500 total points
ID: 18002548
well the logic ur implementing of assigning ds to cr is ok !! ive not really checked that
but better you check with this. this working fine:-

Private Sub cmdCountry_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim custReport As Report1_View
        custReport = New Report1_View
        custReport.CrystalReportViewer1.ReportSource = rptParameter
        custReport.CrystalReportViewer1.SelectionFormula = "{Customers.Country}='Brazil'"
        custReport.Show()
End Sub
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Get Client IP on RDS - VB.NET 15 70
export data table to excel in vb.net 10 36
RLDC Reporting in Visual studio 11 30
DataGridView / get bound table name? 8 28
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question