<?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: Union Query</title><link>https://www.infopathdev.com:443/forums/thread/17431.aspx</link><pubDate>Wed, 07 Feb 2007 04:35:45 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17431</guid><dc:creator>dpsavy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17431.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17431</wfw:commentRss><description>Hey Matt,&lt;br /&gt;&lt;br /&gt;You know its funny that would seem obvious but I just didn't think of it before you said something. Basically, all I have to do is create the union query and then create a select query based on that union query. I think that is what you are saying, right? Simple enough, and much much more efficient. Thanks again.</description></item><item><title>Re: Union Query</title><link>https://www.infopathdev.com:443/forums/thread/17430.aspx</link><pubDate>Tue, 06 Feb 2007 18:22:18 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17430</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17430.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17430</wfw:commentRss><description>Hi Darrell,&lt;br /&gt;&lt;br /&gt;I think the easiest way to do this would be to create a view in SQL and then connect to that view from InfoPath. This also seems like it would be more performant, but I can't vouch for that.&lt;br /&gt;Hope this helps!</description></item><item><title>Union Query</title><link>https://www.infopathdev.com:443/forums/thread/16867.aspx</link><pubDate>Tue, 06 Feb 2007 01:56:53 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:16867</guid><dc:creator>dpsavy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/16867.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=16867</wfw:commentRss><description>Hello All,&lt;br /&gt;&lt;br /&gt;Is it possible to execute a union query from infopath? Basically I need to display a table of questions pulled from two separate tables. Each of those tables have to right join another two tables to filter the questions displayed to a particular work center. Here is what the code looks like:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub BuildCheckList()&lt;br /&gt;Dim i&lt;br /&gt;Dim flw&lt;br /&gt;Dim fw&lt;br /&gt;&lt;br /&gt;'Set the filters and query the secondary data source.&lt;br /&gt;flw = XDocument.DOM.SelectSingleNode("//my:Filters/my:fltrWC").text&lt;br /&gt;&lt;br /&gt;fw = "SELECT CORE.NUMBER, CORE.QTYPE, CORE.TYPE, CORE.QUESTION FROM CORE LEFT JOIN WCQUEST ON CORE.NUMBER = WCQUEST.QNUMBER WHERE (((WCQUEST.WORKCTR)='" &amp; flw &amp; "')) OR (((WCQUEST.WORKCTR)='ALL')) UNION ALL SELECT SUP.NUMBER, SUP.QTYPE, SUP.TYPE, SUP.QUESTION FROM SUP LEFT JOIN SUPWC ON SUP.NUMBER = SUPWC.NUMBER WHERE (((SUPWC.WORKCTR)='" &amp; flw &amp; "')) OR (((SUPWC.WORKCTR)='ALL')) Order By NUMBER "&lt;br /&gt;&lt;br /&gt;XDocument.DataObjects("CCORE").QueryAdapter.Command = fw&lt;br /&gt;XDocument.DataObjects("CCORE").Query()&lt;br /&gt;&lt;br /&gt;'retrieve the secondary data tables.&lt;br /&gt;Set SDS = XDocument.DataObjects("CCORE").DOM.getElementsByTagName("d:CORE")&lt;br /&gt;&lt;br /&gt;'Clone Row before Clearing the PDS table.&lt;br /&gt;Set PDS = XDocument.DOM.selectSingleNode("//my:CheckLists/my:CheckList")&lt;br /&gt;Set Seed = PDS.cloneNode(true)&lt;br /&gt;&lt;br /&gt;'Delete all rows from PDS table.&lt;br /&gt;Set PDS = XDocument.DOM.selectNodes("//my:CheckLists/my:CheckList")&lt;br /&gt;For i = 0 to (PDS.length - 1)&lt;br /&gt;   Set row = PDS.item(i)&lt;br /&gt;   row.parentNode.removeChild(row)&lt;br /&gt;Next&lt;br /&gt;&lt;br /&gt;'Populate the PDS table with the new data.&lt;br /&gt;For i = 0 to (SDS.length - 1)&lt;br /&gt;	Set parent = XDocument.DOM.selectSingleNode("//my:CheckLists")&lt;br /&gt;	Set PDS = parent.selectSingleNode("./my:CheckList[last()]")&lt;br /&gt;	Seed.selectSingleNode("my:Number").text = SDS.Item(i).getAttribute("NUMBER")&lt;br /&gt;	Seed.selectSingleNode("my:QType").text = SDS.Item(i).getAttribute("QTYPE")&lt;br /&gt;	Seed.selectSingleNode("my:Type").text = SDS.Item(i).getAttribute("TYPE")&lt;br /&gt;	Seed.selectSingleNode("my:Question").text = SDS.Item(i).getAttribute("QUESTION")&lt;br /&gt;	If i = 0 Then&lt;br /&gt;		parent.insertBefore Seed, PDS&lt;br /&gt;	Else&lt;br /&gt;		parent.insertBefore Seed, PDS.nextSibling&lt;br /&gt;	End If&lt;br /&gt;Next&lt;br /&gt;&lt;br /&gt;If Err Then&lt;br /&gt;	XDocument.UI.Alert "Error " &amp; Err.number &amp; ": " &amp; Err.Description&lt;br /&gt;End If&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;As always your help is immeasurably appreciated.&lt;br /&gt; &lt;br /&gt;</description></item></channel></rss>