<?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: Autonumbering in Infopath</title><link>https://www.infopathdev.com:443/forums/thread/17160.aspx</link><pubDate>Wed, 01 Nov 2006 16:51:39 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17160</guid><dc:creator>slslusher</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17160.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17160</wfw:commentRss><description>I've tried using this code in developing a form with an autonumbering field.  I created an SQL DB table, with one field (FormID).&lt;br /&gt;I'm getting and error when I try to preview and test this code.&lt;br /&gt;&lt;br /&gt;"An item with the following index does not exist in the collection: qryGetFormID&lt;br /&gt;File:script.js&lt;br /&gt;Line:38"&lt;br /&gt;&lt;br /&gt;I can't seem to find anything on this error to help me correct it.&lt;br /&gt;Any suggestions?  Thanks&lt;br /&gt;Sherry</description></item><item><title>Re: Autonumbering in Infopath</title><link>https://www.infopathdev.com:443/forums/thread/17159.aspx</link><pubDate>Thu, 09 Feb 2006 00:59:58 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17159</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17159.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17159</wfw:commentRss><description>The .DOM. in the first line is the only difference.&lt;br /&gt;&lt;br /&gt;Patrick Halstead [InfoPath MVP]&lt;br /&gt;InfoPathDev</description></item><item><title>Re: Autonumbering in Infopath</title><link>https://www.infopathdev.com:443/forums/thread/17158.aspx</link><pubDate>Wed, 08 Feb 2006 08:55:17 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17158</guid><dc:creator>Agni Jonnalagadda</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17158.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17158</wfw:commentRss><description>&lt;font color="red"&gt;objDataObject.DataObjects("qryGetTicketNumber").setProperty("SelectionNamespaces", &lt;br /&gt;'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" &lt;br /&gt;xmlns:d="http://schemas.microsoft.com/office/infopath/2003/ado/dataFields"');&lt;/font id="red"&gt; &lt;br /&gt;&lt;br /&gt; Should be&lt;br /&gt;&lt;br /&gt;&lt;font color="green"&gt;objDataObject.DataObjects("qryGetTicketNumber").DOM.setProperty("SelectionNamespaces", &lt;br /&gt;'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" &lt;br /&gt;xmlns:d="http://schemas.microsoft.com/office/infopath/2003/ado/dataFields"');&lt;/font id="green"&gt;&lt;br /&gt;&lt;br /&gt;Agni&lt;br /&gt;InfoPath Dev India</description></item><item><title>Re: Autonumbering in Infopath</title><link>https://www.infopathdev.com:443/forums/thread/17157.aspx</link><pubDate>Tue, 07 Feb 2006 21:49:40 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17157</guid><dc:creator>lisaspencer</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17157.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17157</wfw:commentRss><description>I've been working on something else, sorry I'm so late.&lt;br /&gt;&lt;br /&gt;function XDocument::OnLoad(eventObj)&lt;br /&gt;{&lt;br /&gt;if (XDocument.IsNew) &lt;br /&gt;   {&lt;br /&gt;   var objDataObject;&lt;br /&gt;   // Set a reference to the specified data object, have to use DataObjects because qryGetTicketNumber is a secondary data source.&lt;br /&gt;   //Run the query&lt;br /&gt;   objDataObject = XDocument.DataObjects("qryGetTicketNumber").Query;&lt;br /&gt;   objDataObject.DataObjects("qryGetTicketNumber").setProperty("SelectionNamespaces", &lt;br /&gt;   'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" &lt;br /&gt;   xmlns:d="http://schemas.microsoft.com/office/infopath/2003/ado/dataFields"'); &lt;br /&gt;   XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:TicketData/@ticketNumber").nodeTypedValue = lastTicketNumUsed;&lt;br /&gt;   var lastTicketNumUsed = XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:qryGetTicketNumber/@FirstofTicketID").nodeTypedValue;&lt;br /&gt;   lastTicketNumUsed = lastTicketNumUsed + 1;&lt;br /&gt;   XDocument.DOM.selectSingleNode( "/dfs:myFields/my:TicketNumber" ).text = XDocument.DOM.selectSingleNode( "/dfs:myFields/dfs:dataFields/d:TicketData/@TicketNumber" ).text;&lt;br /&gt;   }	  &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Lisa Spencer&lt;br /&gt;Programmer/Office Specialist</description></item><item><title>Re: Autonumbering in Infopath</title><link>https://www.infopathdev.com:443/forums/thread/17156.aspx</link><pubDate>Fri, 03 Feb 2006 02:14:26 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17156</guid><dc:creator>ForumAdmin</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17156.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17156</wfw:commentRss><description>Hi again Lisa,&lt;br /&gt;Can you paste in your latest code so we can check it out?</description></item><item><title>Re: Autonumbering in Infopath</title><link>https://www.infopathdev.com:443/forums/thread/17155.aspx</link><pubDate>Tue, 31 Jan 2006 14:54:18 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17155</guid><dc:creator>lisaspencer</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17155.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17155</wfw:commentRss><description>I'm getting an "object doesn't support this property or method" error now.&lt;br /&gt;&lt;br /&gt;Lisa Spencer&lt;br /&gt;Programmer/Office Specialist</description></item><item><title>Re: Autonumbering in Infopath</title><link>https://www.infopathdev.com:443/forums/thread/17154.aspx</link><pubDate>Tue, 31 Jan 2006 09:14:26 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17154</guid><dc:creator>Shiva</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17154.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17154</wfw:commentRss><description>Hi Lisa Spencer,&lt;br /&gt;&lt;br /&gt;Before selecting the node you have to set the property or namespace of "dfs" as below mentioned. You get the “dfs” prefix namespace from your “qryGetTicketNumber.xml”.&lt;br /&gt;&lt;br /&gt;objDataObject.GetDOM("qryGetTicketNumber").setProperty("SelectionNamespaces", 'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"');&lt;br /&gt;&lt;br /&gt;I Hope this helps you.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Shiva&lt;br /&gt;InfoPath Dev&lt;br /&gt;INDIA</description></item><item><title>Re: Autonumbering in Infopath</title><link>https://www.infopathdev.com:443/forums/thread/17153.aspx</link><pubDate>Tue, 31 Jan 2006 08:30:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17153</guid><dc:creator>Coita Thierry</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17153.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17153</wfw:commentRss><description>Hi,&lt;br /&gt;&lt;br /&gt;you need to make a:&lt;br /&gt;&lt;br /&gt;.setProperty("SelectionNamespaces", "xmlns:dfs=\"http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\"");&lt;br /&gt;&lt;br /&gt;On your object.&lt;br /&gt;</description></item><item><title>Re: Autonumbering in Infopath</title><link>https://www.infopathdev.com:443/forums/thread/17152.aspx</link><pubDate>Mon, 30 Jan 2006 15:58:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17152</guid><dc:creator>lisaspencer</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17152.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17152</wfw:commentRss><description>I'm still working on it!&lt;br /&gt;&lt;br /&gt;var objDataObject;&lt;br /&gt;objDataObject = XDocument.DataObjects("qryGetTicketNumber");&lt;br /&gt;XDocument.DataObjects("qryGetTicketNumber").Query();&lt;br /&gt;XDocument.DOM.selectSingleNode( "/dfs:myFields/my:TicketNumber" ).text = XDocument.DOM.selectSingleNode ("/dfs:myFields/dfs:dataFields/d:TicketData/@TicketNumber" ).text;&lt;br /&gt;&lt;br /&gt;I'm getting a "reference to undeclared namespace prefix:'dfs'" error.  Any help is greatly appreciated!&lt;br /&gt;&lt;br /&gt;Lisa Spencer&lt;br /&gt;Programmer/Office Specialist</description></item><item><title>Re: Autonumbering in Infopath</title><link>https://www.infopathdev.com:443/forums/thread/17151.aspx</link><pubDate>Thu, 19 Jan 2006 22:59:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17151</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17151.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17151</wfw:commentRss><description>This XPath will access a ticketID, but you must specify which one you want. To use some of the SQL stuff that I suggested above check out the following code:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;XDocument.QueryAdapter.Command = "SELECT CustomerID FROM Customers ORDER BY CustomerID DESC";&lt;br /&gt;XDocument.Query();&lt;br /&gt;&lt;br /&gt;XDocument.DOM.selectSingleNode( "/dfs:myFields/my:lastID" ).text = XDocument.DOM.selectSingleNode( "/dfs:myFields/dfs:dataFields/d:Customers/@CustomerID" ).text;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;NOTE: The above code was something that I created after designing a new blank form with a connection to NWind.mdb (the Microsoft sample database).  You will have to edit the XPath statements and the SQL statement to match your solution.&lt;br /&gt;&lt;br /&gt;Once the above code is run it will set the helper node (my:lastID) to the ID that returns last with a natural ordering.  In you case this will be the largest number.&lt;br /&gt;&lt;br /&gt;I'm sorry for suggesting the LIMIT clause, it seems that Microsoft Jet SQL doesn't allow this.  However, you could use a WHERE clause to achieve something similiar.  The main reason for using a LIMIT clause is performance reasons.  See the following link for further reference:&lt;br /&lt;a target="_blank" href=http://office.microsoft.com/en-us/assistance/HP010322871033.aspx&gt;http://office.microsoft.com/en-us/assistance/HP010322871033.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I hope this helps, if you want to e-mail me your e-mail address (the forum hides actual e-mail addresses from us) I will mail you the .xsn I just created so you can use it as an example.&lt;br /&gt;&lt;br /&gt;---------------&lt;br /&gt;Matt Faus&lt;br /&gt;InfoPath Dev Texas&lt;br /&gt;</description></item><item><title>Re: Autonumbering in Infopath</title><link>https://www.infopathdev.com:443/forums/thread/17150.aspx</link><pubDate>Thu, 19 Jan 2006 21:50:38 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17150</guid><dc:creator>lisaspencer</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17150.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17150</wfw:commentRss><description>I have bought the "Programming in Infopath" book.  It just takes so much &lt;br /&gt;time to read a book, I'm just trying to get this one automatic field &lt;br /&gt;done now.  No, the error is when I am trying to set the variable to the &lt;br /&gt;last ticket number in the database.  I am trying to reference the database.&lt;br /&gt;I have var lastTicketNumUsed = Document.DOM.selectSingleNode "/dfs:myFields/dfs:dataFields/d:qryGetTicketNumber/@FirstofTicketID" ).nodeTypedValue; &lt;br /&gt;If I am way off, I think I'll just stop and read the book!&lt;br /&gt;&lt;br /&gt;Lisa Spencer&lt;br /&gt;Programmer/Office Specialist</description></item><item><title>Re: Autonumbering in Infopath</title><link>https://www.infopathdev.com:443/forums/thread/17149.aspx</link><pubDate>Thu, 19 Jan 2006 21:38:39 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17149</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17149.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17149</wfw:commentRss><description>I certainly do not mind answering questions, I just thought you might get faster and/or better response from a book or other refined resource.  I spend maybe 2 minutes on these replies but people have poured over books for months and months to make them as easy-to-understand as possible and contain the best material.&lt;br /&gt;&lt;br /&gt;If you are trying to access the contents of the expression box, you cannot do this.  If you need to reference whatever an expression box stores you will have to add a new node to the schema.&lt;br /&gt;&lt;br /&gt;And again, if you have any more questions please let us know! Good luck!&lt;br /&gt;&lt;br /&gt;---------------&lt;br /&gt;Matt Faus&lt;br /&gt;InfoPath Dev Texas&lt;br /&gt;</description></item><item><title>Re: Autonumbering in Infopath</title><link>https://www.infopathdev.com:443/forums/thread/17148.aspx</link><pubDate>Thu, 19 Jan 2006 21:22:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17148</guid><dc:creator>lisaspencer</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17148.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17148</wfw:commentRss><description>Was that a hint not to ask anymore questions? LOL&lt;br /&gt;Do you know how to resolve the error?&lt;br /&gt;&lt;br /&gt;Lisa Spencer&lt;br /&gt;Programmer/Office Specialist</description></item><item><title>Re: Autonumbering in Infopath</title><link>https://www.infopathdev.com:443/forums/thread/17147.aspx</link><pubDate>Thu, 19 Jan 2006 20:19:40 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17147</guid><dc:creator>Matt Faus</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17147.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17147</wfw:commentRss><description>You cannot access the contents of expression boxes (except with your eyes, haha). You will have to create a new node to store the content if you would like to reference it programmatically. With this XPath the node would have to be in the Access database.  I suggest adding a helper node within Infopath to store the previous, current, and next IDs.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Add a helper node:&lt;/b&gt;&lt;br /&gt;1) Right-click myFields and choose Add&lt;br /&gt;2) Name the field correctly and choose the data type&lt;br /&gt;3) Click OK.&lt;br /&gt;&lt;br /&gt;Also, if you find yourself becoming too frustrated Autonomy Systems provides professional form consulting services to help you get going in the right direction.&lt;a target="_blank" href=http://infopathdev.com/about/default.aspx&gt;http://infopathdev.com/about/default.aspx&lt;/a&gt; . Our very own Patrick Halstead has even written a book titled "Developing Solutions with Microsoft Infopath". A link to this book can be found on the left sidebar of this page.&lt;br /&gt;&lt;br /&gt;---------------&lt;br /&gt;Matt Faus&lt;br /&gt;InfoPath Dev Texas&lt;br /&gt;</description></item><item><title>Re: Autonumbering in Infopath</title><link>https://www.infopathdev.com:443/forums/thread/17146.aspx</link><pubDate>Thu, 19 Jan 2006 19:57:45 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:17146</guid><dc:creator>lisaspencer</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/17146.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=17146</wfw:commentRss><description>Can I do an XPath to the Expression box? Would it be something like this?&lt;br /&gt;/dfs:myFields/dfs:dataFields/d:qryGetTicketNumber/@FirstofTicketID  I get&lt;br /&gt;an error-invalid location path.Thanks,&lt;br /&gt;&lt;br /&gt;Lisa Spencer&lt;br /&gt;Programmer/Office Specialist</description></item></channel></rss>