<?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: Store query results in an array</title><link>https://www.infopathdev.com:443/forums/thread/23450.aspx</link><pubDate>Thu, 04 Oct 2007 14:29:42 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:23450</guid><dc:creator>adamrharding</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/23450.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=23450</wfw:commentRss><description>&lt;p&gt;Stanton&lt;/p&gt;
&lt;p&gt;It is fairly simple to do but to display an array your control needs to be a repeating control or in a repeating table or section.&amp;nbsp; That way it can display multiple results that your query generates.&lt;/p&gt;
&lt;p&gt;Any questions feel free to get back to me&lt;/p&gt;
&lt;p&gt;I hope this helps as I think your code will work then&lt;/p&gt;
&lt;p&gt;Cheers &lt;/p&gt;
&lt;p&gt;Adam&lt;/p&gt;</description></item><item><title>Re: Store query results in an array</title><link>https://www.infopathdev.com:443/forums/thread/20985.aspx</link><pubDate>Wed, 20 Jun 2007 09:19:06 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20985</guid><dc:creator>Stanton Attree</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20985.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=20985</wfw:commentRss><description>&lt;p&gt;Thanks Clay&lt;/p&gt;&lt;p&gt;OK.&amp;nbsp; I can change the &amp;#39;where clause&amp;#39; to compare individual dates with dates in the table - I was trying to be efficient by loading all the dates into&amp;nbsp;memory and reducing the number of function calls and queries/network traffic.&lt;/p&gt;&lt;p&gt;Unfortunately 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 the use of office applications to meet business needs (did that sound like a rant?).&amp;nbsp; I can&amp;#39;t install any of the recommended software.&lt;/p&gt;&lt;p&gt;I can pull a single row back from a table, but I don&amp;#39;t know how to assign the value to a variable.&amp;nbsp; 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;Please don&amp;#39;t laugh at my code - I have been teaching myself over the last few weeks.&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;</description></item><item><title>Re: Store query results in an array</title><link>https://www.infopathdev.com:443/forums/thread/20950.aspx</link><pubDate>Tue, 19 Jun 2007 17:02:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20950</guid><dc:creator>Clay Fox</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20950.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=20950</wfw:commentRss><description>&lt;p&gt;Hey Stanton,&lt;/p&gt;&lt;p&gt;Welcome to the forum.&lt;/p&gt;&lt;p&gt;I have done similar solutions.&lt;/p&gt;&lt;p&gt;You cannot query a secondary data connection other than load all information. Then you have to use filtering to extract just the data you want.&amp;nbsp; So maybe you would say date where holiday name = &amp;quot;New Years&amp;quot; for example.&amp;nbsp; This would return the date from the secondary data source in the row that had the holiday name New Years.&lt;/p&gt;&lt;p&gt;As far as best practices go I would try the Database Accelerator Web Services Suite that you can download here. &lt;a href="http://www.infopathdev.com/files/folders/dbxldownload/entry19957.aspx" target="_blank"&gt;Qdabra Database Accelerator Suite Version 2.0 - Developer&lt;/a&gt;&lt;/p&gt;&lt;p&gt;With this you can use webservices to connect to your data and can actually query your secondary tables.&amp;nbsp; Web services free you from several of the limitations present in Infopath and interacting with Databases.&amp;nbsp; It also includes an active directory web service so you can validate the user of your form. It also provides security so that you can control who sees what data.&lt;/p&gt;&lt;p&gt;A ton of features.&amp;nbsp; You would just need to upgrade from Access to SQL Express, which is free, and have IIS and you would be ready to go.&lt;/p&gt;&lt;p&gt;I have done it with and without and it is much easier and you can create much better solutions using&amp;nbsp;web services.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Store query results in an array</title><link>https://www.infopathdev.com:443/forums/thread/20931.aspx</link><pubDate>Tue, 19 Jun 2007 09:55:12 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:20931</guid><dc:creator>Stanton Attree</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/20931.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=20931</wfw:commentRss><description>&lt;p&gt;Hi&lt;/p&gt;&lt;p&gt;I have successfully developed a form linked with an access database.&amp;nbsp; The form is for absence recording and I am looping through a date range excluding non-working days.&amp;nbsp; I have one task remaining which is to retrieve a set of holiday dates from a table and exclude them.&lt;/p&gt;&lt;p&gt;I have set up the secondary connection and the query but I don&amp;#39;t know how to query the table so that I can get rows back and store them in an array.&lt;/p&gt;&lt;p&gt;I don&amp;#39;t know how to access the data except when it is updated in a form control - I have tried creating a dummy control bound to the table column but I can&amp;#39;t seem to get this to work - I don&amp;#39;t think this is a very good approach anyway.&lt;/p&gt;&lt;p&gt;Any guidance would be much appreciated.&lt;/p&gt;</description></item></channel></rss>