?
Solved

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

Posted on 2006-06-02
6
Medium Priority
?
330 Views
Last Modified: 2008-01-16
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

0
Comment
Question by:Kudzullc
  • 3
  • 3
6 Comments
 
LVL 3

Author Comment

by:Kudzullc
ID: 16820252
any ideas?
0
 
LVL 7

Expert Comment

by:5thcav
ID: 16821045
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,,,
0
 
LVL 3

Author Comment

by:Kudzullc
ID: 16835453
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
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Accepted Solution

by:
5thcav earned 1500 total points
ID: 16837844
you could load the data into a dataset then go through each row..

for each row in ds.tables
0
 
LVL 7

Expert Comment

by:5thcav
ID: 16837894
0
 
LVL 3

Author Comment

by:Kudzullc
ID: 16862142
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
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
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…
Integration Management Part 2
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

839 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