Difficulty using XML Datasets for Mailmerge

My data is returned from a WebService using XML and then read into a DataSet; however, MailMerge.Execute only accepts a DataTable instead of a DataSet.

It would be useful if MailMerge.Exectute allowed a second parameter when passing a Dataset which would identify the table to use when performing the Merge.

MailMerge.Execute(ds, “SourceTable”);

I assume I could use ExecuteWithRegions but I don’t want to have to encode TableStart and TableEnd in my documents when using the Execute statement.

I also want to avoid creating a DataTable from a table of my Dataset retaining both in memory.

Do you have any suggestions?

Thank you.

Hi,

Thank you for the suggestion. However, the method you’ve suggested is fully equivalent to

MailMerge.Execute(ds.Tables[“SourceTable”]);

And you will not create a new DataTable this way, just obtain a table object contained in the DataSet table collection and pass it to MailMerge.Execute.