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.rptViewProjec t1.SetPara meterValue ("id", drChange("id").ToString)
newfrmReport.rptViewProjec t1.SetPara meterValue ("entrytyp e", drChange("entrytype").ToSt ring)
newfrmReport.rptViewProjec t1.SetPara meterValue ("userid", drChange("userid").ToStrin g)
newfrmReport.rptViewProjec t1.SetPara meterValue ("category ", drChange("category").ToStr ing)
newfrmReport.rptViewProjec t1.SetPara meterValue ("time_sta mp", drChange("time_stamp").ToS tring)
newfrmReport.rptViewProjec t1.SetPara meterValue ("date_sta mp", drChange("date_stamp").ToS tring)
newfrmReport.rptViewProjec t1.SetPara meterValue ("members" , drChange("members").ToStri ng)
newfrmReport.rptViewProjec t1.SetPara meterValue ("info", drChange("info").ToString)
newfrmReport.rptViewProjec t1.SetPara meterValue ("project" , drChange("project").ToStri ng)
End While
Catch ex As Exception
MsgBox(ex.ToString, , "Form Load")
End Try
newfrmReport.CrystalReport Viewer1.Re portSource = newfrmReport.rptViewProjec t1
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
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
cnOleDb.Open()
Try
drChange = cmdChange.ExecuteReader
While drChange.Read
newfrmReport.rptViewProjec
newfrmReport.rptViewProjec
newfrmReport.rptViewProjec
newfrmReport.rptViewProjec
newfrmReport.rptViewProjec
newfrmReport.rptViewProjec
newfrmReport.rptViewProjec
newfrmReport.rptViewProjec
newfrmReport.rptViewProjec
End While
Catch ex As Exception
MsgBox(ex.ToString, , "Form Load")
End Try
newfrmReport.CrystalReport
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
drChange = cmd.ExecuteReader()
Do While drChange.Read()
newfrmReport.rptViewProjec t1.SetPara meterValue ("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,,,
Do While drChange.Read()
newfrmReport.rptViewProjec
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,,,
ASKER
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
https://www.experts-exchange.com/questions/21649163/PDF-in-VB-NET.html#15402992
what are you doing with your NULL's ?
what are you doing with your NULL's ?
ASKER
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
Lucas
ASKER