×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Business Objects: Crystal Reports 2 Data Access FAQ

Access 2000

"Push down" record selection to the database server by randysmid
Posted: 12 Oct 04

Hi ALL,
This FAQ is designed to show how to "push-down" the record selection to the database server.  In my case, this was critical because one of my tables has 1.5 million rows.  I am using this with ASP.Net and CR10, but I believe the technique will work in most instances.  Here are the steps I am using:

1) Create a web form where the user can enter the parameters.  On this form, you will need a command button to set the session variables and then call the next web form that contains the Crystal Report Viewer.  You can create a session variable (e.g., "CTARegion") with any name like this:
    Session("CTARegion") = txtRegion.Text

2) Create the report using the fields needed from the various table(s).

3) Create the web form that will hold the Crystal Report Viewer.  In the page load event, I placed the following code:
If Not Page.IsPostBack Then
     'Retrieve parameter value entered in web form
     '  CountySelectRegion.aspx

      Dim strRegion As String
      strRegion = Session("CTARegion".ToString)

     ' connect to Access database
      Dim sConnString As String = _
          "Provider=Microsoft.Jet.OLEDB.4.0;" & _
          "Data Source=" + MapPath("CDR2004.MDB") & ";" & _
          "User ID=Admin;" & _
          "Password="

      Dim oOleDbConnection As OleDb.OleDbConnection = New OleDbConnection(sConnString)
      oOleDbConnection.Open()

     ' build the select statement
      Dim selectString As String = "select * from COUNTY where CTA_RegionID = '" & strRegion & "'"

      Dim tempOleDbDataAdapter As New OleDbDataAdapter(selectString, oOleDbConnection)

      Dim dsCountyRegion As New DataSet

      tempOleDbDataAdapter.Fill(dsCountyRegion, "County")

      Dim cr As CountyRegionRpt
      cr = New CountyRegionRpt

      cr.SetDataSource(dsCountyRegion)
      CrystalReportViewer1.ReportSource = cr

   End If


4) Normally, the Crystal Report Viewer is bound to the report (through Bindings), but in this instance you should not do this.



Back to Business Objects: Crystal Reports 2 Data Access FAQ Index
Back to Business Objects: Crystal Reports 2 Data Access Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close