<?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: Inserting into IDENTITY columns via stored procedure causes IDENTITY to increment at least twice</title><link>https://www.infopathdev.com:443/forums/thread/35777.aspx</link><pubDate>Mon, 15 Dec 2008 19:16:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:35777</guid><dc:creator>Greg S</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/35777.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=35777</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/infopathdev/images/icon-quote.gif"&gt; &lt;strong&gt;Stephen Kent:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt; 
&lt;p&gt;i.e don&amp;#39;t have the data connection called on open and instead assign it as a submit rule....&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t have the data connection set to be called on open.&amp;nbsp; It&amp;#39;s only executed once in code behind.&amp;nbsp; InfoPath is still doing some sort of &amp;quot;pre-execute validation check&amp;quot; even in that scenario.&lt;/p&gt;
&lt;p&gt;Great article by Hilary.&amp;nbsp; I might implement an approach like that in the future.&lt;/p&gt;
&lt;p&gt;-Greg&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Inserting into IDENTITY columns via stored procedure causes IDENTITY to increment at least twice</title><link>https://www.infopathdev.com:443/forums/thread/35565.aspx</link><pubDate>Tue, 09 Dec 2008 23:42:12 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:35565</guid><dc:creator>Stephen Kent</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/35565.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=35565</wfw:commentRss><description>&lt;p&gt;Just call your stored procedure when you need to assign a unique value to the form...&lt;/p&gt;
&lt;p&gt;i.e don&amp;#39;t have the data connection called on open and instead assign it as a submit rule....call the web service to invoke the stored proc, return the value and assign to your form on submit preserving the sequential numbering.&lt;/p&gt;</description></item><item><title>Re: Inserting into IDENTITY columns via stored procedure causes IDENTITY to increment at least twice</title><link>https://www.infopathdev.com:443/forums/thread/35559.aspx</link><pubDate>Tue, 09 Dec 2008 19:07:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:35559</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/35559.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=35559</wfw:commentRss><description>&lt;p&gt;The first call is to generate the schema, which is why it only occurs once per session. &lt;/p&gt;
&lt;p&gt;Now, for the really crazy part.... If you modify your sproc so that it generates a message (actually, don&amp;#39;t know if &lt;strong&gt;*any*&lt;/strong&gt;&amp;nbsp; message will do, that would be interesting to test) by adding a commit without a begin, you may not see the &amp;#39;every other id&amp;#39; feature. I&amp;#39;ve got a blog post &lt;a href="http://www.infopathdev.com/blogs/hilary/archive/2008/11/21/fun-with-sequential-form-ids-sql-and-sprocs.aspx"&gt;here&lt;/a&gt; that mentions this behavior. I would &lt;strong&gt;LOVE&lt;/strong&gt; to know why that works...&lt;/p&gt;</description></item><item><title>Inserting into IDENTITY columns via stored procedure causes IDENTITY to increment at least twice</title><link>https://www.infopathdev.com:443/forums/thread/35553.aspx</link><pubDate>Tue, 09 Dec 2008 17:33:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:35553</guid><dc:creator>Greg S</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/35553.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=35553</wfw:commentRss><description>&lt;p&gt;More of an FYI, but it&amp;#39;s an interesting idiosyncrasy.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;If you have a data connection that inserts records into a SQL table using a stored procedure, and that table uses a field with an IDENTITY (i.e. one that auto-increments), then you might notice that the table skips IDENTITY values (e.g. 1, 3, 5, 6,7, 9 etc.).&amp;nbsp; After looking at the data tables I thought I had a bug in my code somewhere until I realized InfoPath was calling the procedure before any of my code was.&lt;/p&gt;
&lt;p&gt;Just FYI: IDENTITY columns are incremented when a record is inserted – even before the transaction completes.&amp;nbsp; If the transaction is cancelled, or a record is deleted, that particular IDENTITY will never be re-used. &lt;/p&gt;
&lt;p&gt;I can only assume that InfoPath calls the stored procedure once in a transaction, and then cancels it, before the data connection is executed by the form itself.&amp;nbsp; It may do this to test the output structure – who knows.&amp;nbsp; I’ve given up trying to make sense of how InfoPath behaves in certain circumstances with SQL databases.&lt;/p&gt;
&lt;p&gt;It only does this the first time the data connection is executed for a given session.&amp;nbsp; All subsequent executions while the form is open don’t do this.&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>