Solved

SELECT Records for Crystal Report

Posted on 2006-11-23
1
208 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
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now