P
Paul Webster
I am trying to get my head around accessing Secomdary Data Sources using C#
An example in the helpfiles is as follows.
In the following code sample, the name of the secondary data source is
passed to the accessor property of the DataObjectsCollection interface,
which returns a reference to the DataSourceObject object. The data from
the secondary data source is displayed in a message box by using the DOM
property of the DataSourceObject interface to access the xml property of
the XML DOM.
[C#]
public void CTRL1_5_OnClick(DocActionEvent e)
{
// Instantiate a variable to access the specified data object
// from the DataObjectsCollection of the form.
// You must explicitly cast to the DataSourceObject type
// before you can access the data object.
DataSourceObject myDataObject =
thisXDocument.DataObjects["Employees"] as DataSourceObject;
// Display the data from the secondary data source using the
// XML DOM.
thisXDocument.UI.Alert("Data Adapter: " + myDataObject.DOM.xml);
}
I have set up a form with the Northwind Employees table as a secondary
data source calleed Employees, however what I get back in the alert box
is just a long list of characters and numerals, not XML.
There is a second example for setting up a data adapter and putting up
an alert with the connection string, this works fine
Where am I going wrong?
An example in the helpfiles is as follows.
In the following code sample, the name of the secondary data source is
passed to the accessor property of the DataObjectsCollection interface,
which returns a reference to the DataSourceObject object. The data from
the secondary data source is displayed in a message box by using the DOM
property of the DataSourceObject interface to access the xml property of
the XML DOM.
[C#]
public void CTRL1_5_OnClick(DocActionEvent e)
{
// Instantiate a variable to access the specified data object
// from the DataObjectsCollection of the form.
// You must explicitly cast to the DataSourceObject type
// before you can access the data object.
DataSourceObject myDataObject =
thisXDocument.DataObjects["Employees"] as DataSourceObject;
// Display the data from the secondary data source using the
// XML DOM.
thisXDocument.UI.Alert("Data Adapter: " + myDataObject.DOM.xml);
}
I have set up a form with the Northwind Employees table as a secondary
data source calleed Employees, however what I get back in the alert box
is just a long list of characters and numerals, not XML.
There is a second example for setting up a data adapter and putting up
an alert with the connection string, this works fine
Where am I going wrong?