around this issue You need to change the logic of your reads. Place the reader outside of the PrintPage event and in it read and DrawString etc until the page is full or reader is empty. Then return from the event. It will be called again automatically if HasMorePages is true..
SqlDataReader dr = null;
PrintDocument pdoc = null;
int pageNr = 0;
private void printButton_Click(object sender, EventArgs e)
// connect and open reader
// set up the print document..
pdoc = new PrintDocument();
pdoc.DocumentName = "Printer Test";
pdoc.PrintPage += PrintDocument_PrintPage;
pageNr = 0;
// close connection & reader..
private void PrintDocument_PrintPage(object sender, PrintPageEventArgs e)
bool pageDone = false;
if (pageNr > maxPage) return; // optional
e.HasMorePages = true; // we have more data
// print stuff
// if each Read fills one page..:
pageDone = true; // ..or else use condition like y > yMax
if (pageDone) return; // return to print next page
wish of those help When you initialize the BinaryTreeArray(), you set the field variable "size" to 100 and use this to initialize the data Listing array. When you print out the data, the loop uses the same "size" variable so you get all 100 entries, including the null entries. A simple solution would be to filter the data for null when you show all.
public class BinaryTreeArray
public void showAll()
for(int i=0; i<size; i++)
if (data[i] != null)
System.out.print(data[i] + " ");
load more records script show the same last record from a previous set of records if a new record is added
This might help you I'm very confused and I don't know how to solve this problem i'm not sure if I have to adjust the jQuery or the SQL to properly show this without duplicates. I just don't know, so I have this script that loads a set of records every time you press the load more button. , Your SQL query is correct but wrong for this situation.
SELECT*FROM records WHERE NOT status='remove' ORDER BY ID DESC LIMIT $start, $limit";