T
tnbfyles
We are using Visual C++ 6.0 with the msword8 automation added from the
type library. It works well for us so far. But...
We have just noticed that when we use a MailMerge object, the data
source is opened mulitple times.
e.g. Our data source is a stored procedure (in Sybase) that returns a
record set that will be merged with our Word document. The stored
procedure also inserts a record into a logging table to indicate when
it was called.
When we do the following:
merge.OpenDataSource(
"",
covOptional,
covOptional,
covOptional,
covOptional,
covOptional,
covOptional,
covOptional,
covOptional,
covOptional,
covOptional,
COleVariant(connectionString, VT_BSTR),
COleVariant(queryPart1, VT_BSTR),
COleVariant(queryPart2, VT_BSTR));
The stored procedure is called twice (our log table has two records
inserted).
When we do this:
merge.Execute(covFalse);
We get another log entry (the procedure was called again)
And finally, when we close our document:
testDoc.Close(covFalse, covOptional, covOptional);
(testDoc is a _Document object)
The stored procedure is called two more times.
The merge itself works perfectly, and we have been using it for two
years now without a problem, but we just noticed this problem
accidentally when we added the logging feature.
This worries me that the stored procedure is called five times for a
single document merge, particularly from a performance perspective.
Is this working as designed? Is there a way to change this behaviour?
Thanks for any help
Tony.
type library. It works well for us so far. But...
We have just noticed that when we use a MailMerge object, the data
source is opened mulitple times.
e.g. Our data source is a stored procedure (in Sybase) that returns a
record set that will be merged with our Word document. The stored
procedure also inserts a record into a logging table to indicate when
it was called.
When we do the following:
merge.OpenDataSource(
"",
covOptional,
covOptional,
covOptional,
covOptional,
covOptional,
covOptional,
covOptional,
covOptional,
covOptional,
covOptional,
COleVariant(connectionString, VT_BSTR),
COleVariant(queryPart1, VT_BSTR),
COleVariant(queryPart2, VT_BSTR));
The stored procedure is called twice (our log table has two records
inserted).
When we do this:
merge.Execute(covFalse);
We get another log entry (the procedure was called again)
And finally, when we close our document:
testDoc.Close(covFalse, covOptional, covOptional);
(testDoc is a _Document object)
The stored procedure is called two more times.
The merge itself works perfectly, and we have been using it for two
years now without a problem, but we just noticed this problem
accidentally when we added the logging feature.
This worries me that the stored procedure is called five times for a
single document merge, particularly from a performance perspective.
Is this working as designed? Is there a way to change this behaviour?
Thanks for any help
Tony.