Crystal Report Parameters

Hi, I have a dataset attached to my crystal report which returns specific results. When testing the query my results return my specific records. However, when I run it in my crystal report I get all records in my table. It is as if my sql query is not being recognized by the report? Im using 2008.

The code for my report is below:

            Dim ds As New DataSet

            Dim sqlString As String = "SELECT l.JobNo,l.Description,l.Solution,l.JobLoggedDate,l.DateComplete,l.Parts,l.RaisedBy," & _
                "l.Customer,c.Company FROM tblJobsList l INNER JOIN tblCustomers c ON l.Customer = c.ID " & _
                "WHERE c.Company = '" & gbCustomer & "' AND l.JobLoggedDate >= '" & ScottFunc.ConvertDate(gbFromDate) & "' " & _
                "AND l.DateComplete <= '" & ScottFunc.ConvertDate(gbToDate) & "' ORDER BY l.JobLoggedDate "

            'Open Database

            'Create a sql adapter from criteria entered then fill the dataset
            Dim daService As New SqlDataAdapter(sqlString, myConnection)

            'Fill adapter and assign table
            daService.Fill(ds, "JobsList")

            'Set SQL to Report
            rptMonthlyReport1.SetDatabaseLogon("sa", "gotham")

            'Assign the Report to show to the viewer
            crViewer.ReportSource = rptMonthlyReport1

Any help is appreciated.
SCOTT78Technical AdvisorAsked:
Who is Participating?
Good point.  I believe to have a report use a dataset it must be built against a dataset otherwise it will look for and use the database.

Is the report saved with data?
That is the Crystal default.
Try adding this line before you assign the datasource


If you refresh the report does it show the correct results?

SCOTT78Technical AdvisorAuthor Commented:
Thanks for the suggestion but it doesnt work. I have tried using 'load' and 'refresh' but neither of them make a difference.
How was the report designed? Using a dataset or using the database? Why do you need

 rptMonthlyReport1.SetDatabaseLogon("sa", "gotham")

if you are using a dataset?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.