<?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>SQL Database Integration</title><link>https://www.infopathdev.com:443/forums/47.aspx</link><description>For questions concerning issues in the integration of SQL and Microsoft InfoPath.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Storing query result in a variable</title><link>https://www.infopathdev.com:443/forums/thread/21854.aspx</link><pubDate>Fri, 20 Jul 2007 20:59:37 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21854</guid><dc:creator>Greg Collins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21854.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=21854</wfw:commentRss><description>Great! Glad your on the right track! Good luck!</description></item><item><title>Re: Storing query result in a variable</title><link>https://www.infopathdev.com:443/forums/thread/21832.aspx</link><pubDate>Fri, 20 Jul 2007 10:43:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21832</guid><dc:creator>Stanton Attree</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21832.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=21832</wfw:commentRss><description>&lt;p&gt;Thanks for your persistance Greg.&lt;/p&gt;&lt;p&gt;The namespaces are OK.&amp;nbsp; I&amp;#39;ve tracked it down to my modified SQL command for the secondary data source.&amp;nbsp; I am attempting to select on a date incorrectly somehow and this is causing the DOM to become invalid.&amp;nbsp; If I select manually on the ID (numeric) field in the SQL, everything is OK.&lt;/p&gt;&lt;p&gt;I will endeavor to discover how infopath wants the SQL where clause to look when selecting a date on a date column.&lt;/p&gt;</description></item><item><title>Re: Storing query result in a variable</title><link>https://www.infopathdev.com:443/forums/thread/21823.aspx</link><pubDate>Thu, 19 Jul 2007 23:55:39 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21823</guid><dc:creator>Greg Collins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21823.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=21823</wfw:commentRss><description>&lt;p&gt;The data source task pane unfortunately does not show all the namespaces. If you are using InfoPath 2007, a useful new feature I requested was implemented by the IP dev team which allows you to right-click on the field of interest and copy the complete XPath to that field to the clipboard. If you are using InfoPath 2003, then you should extract your form files, open the HolidayCalendar.xml file with a text editor, and disect that to pull out the appropriate namespaces for each node in your XPath.&lt;/p&gt;&lt;p&gt;Using the full set of namespaces from the main DOM is good as it will ensure that you are totally covered since it incorporates all namespaces for every DOM in the form template.&lt;/p&gt;</description></item><item><title>Re: Storing query result in a variable</title><link>https://www.infopathdev.com:443/forums/thread/21798.aspx</link><pubDate>Thu, 19 Jul 2007 10:35:58 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21798</guid><dc:creator>Stanton Attree</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21798.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=21798</wfw:commentRss><description>&lt;p&gt;Thanks again Greg.&lt;/p&gt;&lt;p&gt;I am suspecting that this might be a lack of understanding on my part&amp;nbsp;of namespaces for secondary data sources.&amp;nbsp; I have set the SelectionNamespaces to the same as the main data source.&amp;nbsp; See code below:&lt;/p&gt;&lt;p&gt;XDocument.DOM.setProperty &amp;quot;SelectionNamespaces&amp;quot;, &amp;quot;xmlns:xsi=&amp;quot;&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;quot; xmlns:q=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2003/ado/queryFields&amp;quot;&amp;quot; xmlns:d=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2003/ado/dataFields&amp;quot;&amp;quot; xmlns:dfs=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2003/dataFormSolution&amp;quot;&amp;quot; xmlns:my=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-06-06T12:26:30&amp;quot;&amp;quot; xmlns:xd=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2003&amp;quot;&amp;quot;&amp;quot;&lt;/p&gt;&lt;p&gt;XDocument.GetDOM(&amp;quot;HolidayCalendar&amp;quot;).setProperty &amp;quot;SelectionNamespaces&amp;quot;, &amp;quot;xmlns:xsi=&amp;quot;&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;quot; xmlns:q=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2003/ado/queryFields&amp;quot;&amp;quot; xmlns:d=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2003/ado/dataFields&amp;quot;&amp;quot; xmlns:dfs=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2003/dataFormSolution&amp;quot;&amp;quot; xmlns:my=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-06-06T12:26:30&amp;quot;&amp;quot; xmlns:xd=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2003&amp;quot;&amp;quot;&amp;quot;&lt;/p&gt;&lt;p&gt;The Data Source Window shows the following:&lt;/p&gt;&lt;p&gt;&amp;nbsp;- myFields&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - dataFields&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;- d:HolidayCalendar&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :ID&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :BankHolidayDate&lt;/p&gt;&lt;p&gt;Have I got something wrong?&amp;nbsp; When I click on the details of the data sources, the namespace information is the same as the main data source.&lt;/p&gt;&lt;p&gt;I only seem to be able to access data that is stored in the main data source.&lt;/p&gt;&lt;p&gt;Any help is much appreciated.&lt;/p&gt;</description></item><item><title>Re: Storing query result in a variable</title><link>https://www.infopathdev.com:443/forums/thread/21786.aspx</link><pubDate>Wed, 18 Jul 2007 20:11:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21786</guid><dc:creator>Greg Collins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21786.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=21786</wfw:commentRss><description>&lt;ol start="1"&gt;&lt;li&gt;Verify that &lt;font color="#ff0033"&gt;uCalendarDataSource&lt;/font&gt;&amp;nbsp;is actually a valid object.&lt;/li&gt;&lt;li&gt;Get just the object without trying to access the .text property:&lt;br /&gt;&lt;font color="#ff0033"&gt;uHolidayDate = uCalendarDataSource.selectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:HolidayCalendar/@BankHolidayDate&amp;quot;)&lt;/font&gt;&lt;/li&gt;&lt;li&gt;Check whether&amp;nbsp;&lt;font color="#ff0033"&gt;uHolidayDate&lt;/font&gt; is a valid object.&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;My guess is that&amp;nbsp;&lt;font color="#ff0033"&gt;uHolidayDate&lt;/font&gt; is not valid because something is not right in the XPath.&lt;/p&gt;</description></item><item><title>Re: Storing query result in a variable</title><link>https://www.infopathdev.com:443/forums/thread/21769.aspx</link><pubDate>Wed, 18 Jul 2007 10:48:26 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21769</guid><dc:creator>Stanton Attree</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21769.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=21769</wfw:commentRss><description>&lt;p&gt;Thanks Greg&lt;/p&gt;&lt;p&gt;Changed to using GetDom(&amp;quot;HolidayCalendar&amp;quot;) instead of DataObjects(&amp;quot;HolidayCalendar&amp;quot;).DOM but still getting an object required error when using selectSingleNode?&amp;nbsp; I don&amp;#39;t know why I&amp;nbsp;can&amp;#39;t get data into a variable from a secondard data source - it&amp;#39;s frustrating and mystifying.&lt;/p&gt;&lt;p&gt;I&amp;#39;ve tried putting the field on the form and seen it update with the first&amp;nbsp;row&amp;nbsp;in the table, but still getting an object required error.&lt;/p&gt;&lt;p&gt;Either I am doing something wrong or infopath doesn&amp;#39;t allow this?&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Storing query result in a variable</title><link>https://www.infopathdev.com:443/forums/thread/21375.aspx</link><pubDate>Mon, 02 Jul 2007 16:26:59 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21375</guid><dc:creator>Greg Collins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21375.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=21375</wfw:commentRss><description>You should be using GetDOM() rather than DataObjects() in the line&amp;nbsp;two above the red one.</description></item><item><title>Storing query result in a variable</title><link>https://www.infopathdev.com:443/forums/thread/21294.aspx</link><pubDate>Wed, 27 Jun 2007 08:09:26 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:21294</guid><dc:creator>Stanton Attree</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/21294.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=21294</wfw:commentRss><description>&lt;div class="ForumThreadPostContainer" id="PostDisplayContainer" style="visibility:visible;width:863px;height:385px;"&gt;&lt;div class="ForumThreadPostBody"&gt;&lt;div class="ForumThreadPostContent" id="PostDisplayBody" style="width:843px;height:235px;"&gt;&lt;p&gt;I have set up a query so that I&amp;nbsp;pull a single row back from a table (secondary data source), but I don&amp;#39;t know how to assign the value to a variable.&amp;nbsp; &lt;/p&gt;&lt;p&gt;Do I have to bind a form field to a column in the database table and then retrieve the value from the field?&amp;nbsp; I have tried this approach but I am getting an &amp;quot;Object Required&amp;quot; error when trying to get the value from the form field (see function code below).&amp;nbsp; Similar code works elsewhere in the form - maybe there is something wrong with the form field?&amp;nbsp; It is a text box bound to the table in question.&lt;/p&gt;&lt;p&gt;I work for an organisation that has locked-down the PC so that no applications can be installed that are not part of the corporate strategy - hence I can&amp;#39;t install any of the&amp;nbsp;intermediate&amp;nbsp;software to simplify things - I have to use infopath and access as they are.&lt;/p&gt;&lt;p&gt;The &amp;#39;object required&amp;#39; error occurs on the red line below.&amp;nbsp; I hope there is an obvious mistake that can be addressed.&lt;/p&gt;&lt;p&gt;Thanks in advance.&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;Function IsBankHoliday(uSicknessDate)&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; Dim uCalendarDataSource&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; Dim uHolidayDate&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; Dim uOriginalCommand&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; Dim uSingleRowCommand&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; &amp;#39; Modify the SQL command&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; uOriginalCommand = xDocument.DataAdapters(&amp;quot;HolidayCalendar&amp;quot;).Command&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; uSingleRowCommand = uOriginalCommand + &amp;quot; where [BankHolidayDate] = &amp;quot; + FormatDateTime(uSicknessDate, 2)&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; &amp;#39; Query the table with the the single row where clause and then reset the command&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; XDocument.DataAdapters(&amp;quot;HolidayCalendar&amp;quot;).Command = uSingleRowCommand&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; XDocument.DataAdapters(&amp;quot;HolidayCalendar&amp;quot;).Query()&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; XDocument.DataAdapters(&amp;quot;HolidayCalendar&amp;quot;).Command = uOriginalCommand&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; Set uCalendarDataSource = xDocument.DataObjects(&amp;quot;HolidayCalendar&amp;quot;).DOM&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; uCalendarDataSource.setProperty &amp;quot;SelectionNamespaces&amp;quot;, &amp;quot;xmlns:xsi=&amp;quot;&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;quot; xmlns:q=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2003/ado/queryFields&amp;quot;&amp;quot; xmlns:d=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2003/ado/dataFields&amp;quot;&amp;quot; xmlns:dfs=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2003/dataFormSolution&amp;quot;&amp;quot; xmlns:my=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-06-06T12:26:30&amp;quot;&amp;quot; xmlns:xd=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2003&amp;quot;&amp;quot;&amp;quot;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="#ff0033"&gt;uHolidayDate = uCalendarDataSource.selectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:HolidayCalendar/@BankHolidayDate&amp;quot;).text&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; If Len(uHolidayDate) &amp;gt; 0 Then&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IsBankHoliday = True&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; Else&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IsBankHoliday = False&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; End If&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;End Function&lt;/font&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description></item></channel></rss>