Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / November 2005

Tip: Looking for answers? Try searching our database.

Trouble with Microsoft Example Code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul Webster - 09 Nov 2005 18:21 GMT
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?
Paul Webster - 09 Nov 2005 18:53 GMT
> I am trying to get my head around accessing Secomdary Data Sources using C#
>
[quoted text clipped - 30 lines]
>
> Where am I going wrong?

I have sorted it out thankyou. Connecting to a small database that I
created I can see sensible XML being displayed.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.