Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing using a data reader

Status
Not open for further replies.

kyledunn

Programmer
Jan 2, 2001
145
US
Hi guys,

In a PrintPage event I am opening a data reader and reading the records in a while loop. When I reach the MarginBounds I am setting e.HasMorePages to true followed by a return statement. When the next page attempts to print and the PrintPage event executes again it runs all of the code within the PrintPage method creating an error condition and does not just continue at the same place in the while loop. How is the process of printing a large number of records from a database usually handled?

Kyle
 
I think usually its handled by Crystal Reports
;)

Have you tried something like setting an integer to whatever record number ist going through the while loop, and then if the page posts back and triggers the PrintPage event, it checks that integer and if its not 0 or something like that, then it sets a for loop (I know you're using while, but maybe try a for?) that says
For i = intCount To Reader.rows.count (or whatever the syntax is)

Then it would know where to continue counting from.

Total theory, and I"ve never done anyhting like this before, but it sounds like it might work....sorta.
:)

Jack
 
You're definitely on the right track because it is correct that you must maintain some variable that tells you where you are in the printing cycle and continue based on that variable when the next page is called. I haven't had a chance to complete the printing section yet but I now know that I'll be using a dataset and not printing by reading from the source database and that should make it pretty easy to maintain the state of the printing between pages. Thanks for your input.

Kyle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top