Link to home
Start Free TrialLog in
Avatar of Kudzullc
Kudzullc

asked on

Report not working correctly...VB.NET w/ Crystal

Hi Experts,

I have a change management app that I am trying to print dynamically by the options chosen on a previous form.  Below is what I have

 Dim newfrmReport As New frmReport
 Dim drChange As OleDb.OleDbDataReader
 Dim cmdChange As New OleDb.OleDbCommand("SELECT * FROM items order by date_stamp ", cnOleDb)
 cnOleDb.Open()
        Try
            drChange = cmdChange.ExecuteReader
            While drChange.Read
                newfrmReport.rptViewProject1.SetParameterValue("id", drChange("id").ToString)
                newfrmReport.rptViewProject1.SetParameterValue("entrytype", drChange("entrytype").ToString)
                newfrmReport.rptViewProject1.SetParameterValue("userid", drChange("userid").ToString)
                newfrmReport.rptViewProject1.SetParameterValue("category", drChange("category").ToString)
                newfrmReport.rptViewProject1.SetParameterValue("time_stamp", drChange("time_stamp").ToString)
                newfrmReport.rptViewProject1.SetParameterValue("date_stamp", drChange("date_stamp").ToString)
                newfrmReport.rptViewProject1.SetParameterValue("members", drChange("members").ToString)
                newfrmReport.rptViewProject1.SetParameterValue("info", drChange("info").ToString)
                newfrmReport.rptViewProject1.SetParameterValue("project", drChange("project").ToString)
            End While

        Catch ex As Exception
            MsgBox(ex.ToString, , "Form Load")
        End Try
newfrmReport.CrystalReportViewer1.ReportSource = newfrmReport.rptViewProject1
newfrmReport.ShowDialog()
cnOleDb.Close()

This works fine except It is only returning one line of the report and not retreiving all records like I thought I would.  I do not want to bind this report because of its behavior so I would like to be able to change this SQL statement in the future by manipulating the SQL text but now I just want to pull * to make sure it works.  Please let me know what I am missing.  I thought if I looped the Crystal Engine would build a dataset in memory then display in report.

Thanks in advance.

Lucas

Avatar of Kudzullc
Kudzullc

ASKER

any ideas?
drChange = cmd.ExecuteReader()
Do While drChange.Read()
    newfrmReport.rptViewProject1.SetParameterValue("id", drChange("id").ToString)
Loop
conn.Close()


try this "SELECT * FROM items order by date_stamp;"



i cant see to much,, are you sure it completes the read,, did you set any breakpoints and step through,,,
I did debug this many times.  I saw it was looping through the records but it seems as though the connection between this type of OleDb statement and the report are my problem.  Do you know how I can make my report cycle through the while loop?  For instance, I am getting the first report row to show in the report but no more rows.  I am not sure how to make the while loop increment to the next row to show the next record in the loop.  I can make a one record instance show in the report, but after the parameters for the report have been assigned a value, assigning them another does not make them move to next row.  Did I clarify a liitle better this time?

Thanks for the input, I tried the ; after the SQL statement and it works as well with same result as above.  

Lucas
ASKER CERTIFIED SOLUTION
Avatar of 5thcav
5thcav
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Nulls are taken care of before I pass the parameter values to the report inside the form.  I have abandoned this approach but do appreciate the time.  I am currently not working on this project as of right now but will re-visit this at a later date.  I am going to use Stored Procedures in my DataSet to fill the report necessary.  Thanks for the DataSet mention.

Lucas