Missing merge data?

I've been using your word component to merge data to a document for quite some time. I'me busy re-writing my merge wrapper to use the IDataReader but I seem to be missing some data when the merge is done?? I'm expecting 20,000 pages but only get 19,922. What would cause pages not to be merged? I've checked that fields are not null, etc, but I still can't see why... Am I missing something silly?

My test code:

[Test]
public void Merge20KRecordsIn60s()
{
DateTime mergeStartTime;

// prepare merge doc
Document doc = new Document( @"c:\template.doc" );

// get data from db using data readers
using ( SqlConnection con = new SqlConnection( @"server=x;uid=x;pwd=x;database=x" ) )
{
string sql = @"select top 20000 * from dbo.table (nolock) order by column desc";

using ( SqlCommand cmd = new SqlCommand( sql, con ) )
{
cmd.CommandTimeout = 60;
cmd.Connection.Open();

SqlDataReader dr = cmd.ExecuteReader( CommandBehavior.CloseConnection );

mergeStartTime = DateTime.Now;

doc.MailMerge.Execute( dr );

doc.Save( @"c:\results.doc", SaveFormat.FormatDocument );
dr.Close();

}

}

DateTime mergeEndTime = DateTime.Now;
Assert.IsTrue( mergeEndTime < mergeStartTime.AddSeconds( 60 ) );
}

The document template just contains a few of the column names from table.

Hi,

Interesting issue. The mail merge engine just cannot miss any data. Please make sure that exactly 20 000 records are read from the database. Also attach the template, I will do a similar test here.

Interesting indeed. I ran the SQL in Managment studio to got 20,000 back. Then altered the code to do a while ( dr.Read() ) { counter++; } and got 20,000 back too?

I’ve run the test and now I think that your resulting document still contains 20 000 pages… Where did you take the number from? Did you look at the File | Properties | Statistics tab? If I drag the scroll bar down until it stops, the tooltip and the status bar also show 19 922, but once I release it, the status bar shows 20 000. So please see the document statistics.

Ah yes, darn scroll bar! Thanks for the help on that one.

Just another quick question. I'm having to merge a whole lot of data to word for a new client of ours. We are using Aspose.Word in a Web App, and I keep timing out and putting some strain on quite a powerful server. Originally, the solutions was only meant to print a few hundred pages, so DataSet ( with 2 DataTables for parent/child ) was working fine. Now it's a new ball game, having to create 19,000+ pages.

I'm looking at using a DataReader to loop through my header records, convert each row to a String Array and then another DataReader to get the child data.

Have you had any previous cases where this had to be done, or might you have any suggestions?

Sad [:(]

A document containing 20K pages is an EXTREMELY large document. It also occupies lots of memory on the server so this is probably one of the reasons that slow down the process. If you are able to use many small documents instead of one huge, prefer this manner.