<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Data Connections</title><link>https://www.infopathdev.com:443/forums/44.aspx</link><description> </description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Change the Secondary Query</title><link>https://www.infopathdev.com:443/forums/thread/20773.aspx</link><pubDate>Thu, 14 Jun 2007 14:57:37 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20773</guid><dc:creator>davidair</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20773.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=20773</wfw:commentRss><description>&lt;p&gt;This happens because there is no QueryAdapters property...&lt;/p&gt;&lt;p&gt;To access the main query adapter&amp;#39;s command, use this:&lt;/p&gt;&lt;p&gt;XDocument.QueryAdapter.Command&lt;/p&gt;&lt;p&gt;To access a secondary adapter&amp;#39;s command, use this:&lt;/p&gt;&lt;p&gt;XDocument.DataObjects[&amp;quot;Detail&amp;quot;].QueryAdapter.Command&lt;/p&gt;&lt;p&gt;Hope this helps. Also using F1 while editing the code is very helpful, just hit F1 on XDocument to get more info about it.&lt;/p&gt;</description></item><item><title>Change the Secondary Query</title><link>https://www.infopathdev.com:443/forums/thread/20770.aspx</link><pubDate>Thu, 14 Jun 2007 14:37:14 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20770</guid><dc:creator>TogasPoon</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20770.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=20770</wfw:commentRss><description>&lt;p&gt;Whenever I run this code:&lt;/p&gt;&lt;br /&gt;&lt;p&gt;function CTRL2_7::OnClick(eventObj)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Retrieve the value of the field that you want to use as a parameter
&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //to the stored procedure.
&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var planIdValue = XDocument.DOM.selectSingleNode(&amp;quot;/dfs:myFields/my:myPlanId&amp;quot;).text;
 
&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Set the Command for the Query Adapter of the Data Source. Incorporate the 
&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //parameter values that you want to use. 
&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; XDocument.QueryAdapter.Command = &amp;#39;SELECT * FROM Ma_Plans WHERE PlanId = &amp;#39; + planIdValue;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Query the Data Source. 
&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; XDocument.Query();

&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; XDocument.QueryAdapters[&amp;quot;Detail&amp;quot;].Command = &amp;#39;SELECT * FROM vwMaPlanEquipmentDetail WHERE PlanId = &amp;#39; + planIdValue;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; XDocument.QueryAdapters[&amp;quot;Detail&amp;quot;].Query();
&lt;br /&gt;}&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I get the following error on this line:&lt;/p&gt;&lt;p&gt;XDocument.QueryAdapters[&amp;quot;Detail&amp;quot;].Command = &amp;#39;SELECT * FROM vwMaPlanEquipmentDetail WHERE PlanId = &amp;#39; + planIdValue;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;XDocument.QueryAdapters.Detail is null or not an object&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Any ideas?&lt;/p&gt;&lt;p&gt;&amp;nbsp;Thanks&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>