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 / April 2005

Tip: Looking for answers? Try searching our database.

Referencing a node using selectSingleNode....

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Enterprise Andy - 18 Apr 2005 12:56 GMT
Hi,

I am trying to populate a field on my form, which is linked to an SQL
back-end database, but need assistance in referencing the field.

I am trying to use:
XDocument.DOM.selectSingleNode("/my:myfields/my:DataFields/my:TblStaffDetails/my:userName").text

to reference the field, which is called UserName and is part of the
d:TblStaffDetails group, which in turn is a member of the dataFields groups,
which in turn is a member of the myFields group.

The code above causes an error saying '... is null or not an object'. How do
I correctly reference the field so I can populate it onLoad.

Many thanks in advance for you help!
MatsonPP - 18 Apr 2005 13:13 GMT
I am going to assume that since you used the "my:" namespace in your
example, that you linked to the database by doing the "New from data
connection" when you created your form. So, if I follow your example in
reference to field and foler names, then the way to reference your
field is as such:

string str =
XDocument.DOM.selectSingleNode("//d:TblStaffDetails/@userName").text;

I hope that works,
Ciao,
Matt
Enterprise Andy - 18 Apr 2005 14:47 GMT
Thanks for the reply,

I have tried that and I still get and error complaining '... is null or not
an object'. Any ideas why?

> I am going to assume that since you used the "my:" namespace in your
> example, that you linked to the database by doing the "New from data
[quoted text clipped - 8 lines]
> Ciao,
> Matt
 
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.