FileQueryConnection

G

gkinnear

What is wrong with the following code????
I Get the following error: Attempted to read or write protected memory. This
is often an indication that other memory is corrupt.


CODE:

// Create the XmlDocument to accept the query results.
XmlDocument outputFile = new XmlDocument();
outputFile.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\"
?><outputRoot></outputRoot>");

// Create XmlNamespaceManager for XmlDocument object. When
// creating a more complex document, use AddNamespace method
// to add a mapping from namespace prefix to namespace URL
for
// each namespace to this object.
XmlNamespaceManager outputFileNamespaceManager = new
XmlNamespaceManager(outputFile.NameTable);

// Create an XPathNavigator positioned at the root of the
// XmlDocument output file created above.
XPathNavigator outputFileNavigator =
outputFile.CreateNavigator();
XPathNavigator outputRootNavigator =
outputFileNavigator.SelectSingleNode("/outputRoot",
outputFileNamespaceManager);

// Query the XML file defined for the FileQueryConnection
// and log the results in the XmlDocument created above.
FileQueryConnection queryConnection =
(FileQueryConnection)(DataConnections["MergeTest"]);
queryConnection.Execute(outputRootNavigator);
//queryConnection.Execute();

// Insert the results of the query from the XmlDocument in
the
// QueryOutput field of the main data source of the form.
XPathNavigator mainNavigator =
MainDataSource.CreateNavigator();
XPathNavigator queryOutputNavigator =
mainNavigator.SelectSingleNode("/my:myFields/my:QueryOutput",
NamespaceManager);
queryOutputNavigator.SetValue(outputRootNavigator.InnerXml);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top