<?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>Data Connections</title><link>https://www.infopathdev.com:443/forums/44.aspx</link><description> </description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Getting New Primary Key Value After Initial Submit</title><link>https://www.infopathdev.com:443/forums/thread/87063.aspx</link><pubDate>Wed, 13 Feb 2013 22:23:00 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:87063</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/87063.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=87063</wfw:commentRss><description>Thanks so much for posting back with details - it will probably save someone else some frustration. Glad you have it sorted out! :)</description></item><item><title>Re: Getting New Primary Key Value After Initial Submit</title><link>https://www.infopathdev.com:443/forums/thread/87062.aspx</link><pubDate>Wed, 13 Feb 2013 22:14:19 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:87062</guid><dc:creator>abcolson</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/87062.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=87062</wfw:commentRss><description>&lt;p&gt;Problem Solved!&lt;/p&gt;&lt;p&gt;Actually, this is an issue I wish Microsoft would figure out but it may be that this is by design.&lt;/p&gt;&lt;p&gt;Anyways, when I was submitting to the database my table had insert triggers and in the triggers I was sending an email.&amp;nbsp; Not a problem in SQL 2000 but they changed the mechanism (in SQL 2005, I think) to use DB mail (&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;sp_send_dbmail&lt;/font&gt;&lt;/font&gt;).&amp;nbsp; I was sending the email after the table was updated with new records and when I called sp_send_dbmail it changed the value of @@IDENTITY. Hence, InfoPath was picking up the wrong value for the new primary key created.&lt;/p&gt;&lt;p&gt;The solution was to call sp_send_dbmail in the INSTEAD OF INSERT trigger before the table was updated.&amp;nbsp; In the event that there were any failures in the insertion process the email would be aborted which means no stray emails (and this is by design).&lt;/p&gt;&lt;p&gt;This type of thing has bitten me before.&amp;nbsp; Very frustrating.&amp;nbsp; But now we know...&lt;/p&gt;&lt;p&gt;Tony&lt;/p&gt;</description></item><item><title>Re: Getting New Primary Key Value After Initial Submit</title><link>https://www.infopathdev.com:443/forums/thread/87012.aspx</link><pubDate>Tue, 12 Feb 2013 22:04:34 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:87012</guid><dc:creator>abcolson</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/87012.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=87012</wfw:commentRss><description>&lt;p&gt;Yes, Hilary, you are correct.&amp;nbsp; I tried my original test form on a different Windows XP machine with InfoPath 2010 and got the same erroneous behavior.&amp;nbsp; Back on my Windows 7 development machine, I then modified the adapter to point to our old SQL Server 2000 database and I got the correct expected behavior.&lt;/p&gt;&lt;p&gt;Now I need to find out what is different with SQL 2008 vs. SQL 2000.&amp;nbsp; Maybe the link you provided will help me.&lt;/p&gt;&lt;p&gt;Thank you,&lt;/p&gt;&lt;p&gt;Tony&lt;/p&gt;</description></item><item><title>Re: Getting New Primary Key Value After Initial Submit</title><link>https://www.infopathdev.com:443/forums/thread/87008.aspx</link><pubDate>Tue, 12 Feb 2013 20:53:06 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:87008</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/87008.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=87008</wfw:commentRss><description>&lt;p&gt;So - when you tried this and it didn&amp;#39;t fail, was it also with IP 2010? On a Windows 7 machine? There is an ADO.NET bug in Windows 7 that causes weird behavior in forms with Insert and Update statements - not sure if it may be what you are running into or not, but here&amp;#39;s the KB link: &lt;font size="3" face="Times New Roman"&gt;

&lt;/font&gt;&lt;/p&gt;&lt;p style="margin:0in 0in 0pt;" class="MsoNormal"&gt;&lt;span&gt;&lt;a href="http://support.microsoft.com/kb/2591857"&gt;&lt;font color="#0000ff" size="3" face="Calibri"&gt;http://support.microsoft.com/kb/2591857&lt;/font&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="3" face="Times New Roman"&gt;

&lt;/font&gt;&lt;/p&gt;</description></item><item><title>Re: Getting New Primary Key Value After Initial Submit</title><link>https://www.infopathdev.com:443/forums/thread/87005.aspx</link><pubDate>Tue, 12 Feb 2013 20:44:11 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:87005</guid><dc:creator>abcolson</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/87005.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=87005</wfw:commentRss><description>&lt;p&gt;New Development...&lt;/p&gt;&lt;p&gt;The prior examples and behavior were when my form was connected&amp;nbsp;to our new SQL Server 2008 database.&amp;nbsp; When tried with a SQL Server 2000 database, submission of the forms behaved as expected, i.e. the records did not change and the new id was populated as expected.&amp;nbsp; So, it appears that the problem is not with InfoPath 2010 (Whew!) but rather with the back end database...&lt;/p&gt;&lt;p&gt;Well...out of the frying pan and into another frying pan...&lt;/p&gt;&lt;p&gt;If/When I figure it out I&amp;#39;ll post the fix since others may run into the same situation.&lt;/p&gt;</description></item><item><title>Re: Getting New Primary Key Value After Initial Submit</title><link>https://www.infopathdev.com:443/forums/thread/86985.aspx</link><pubDate>Mon, 11 Feb 2013 23:04:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:86985</guid><dc:creator>abcolson</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/86985.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=86985</wfw:commentRss><description>&lt;p&gt;Some further clarification:&lt;/p&gt;&lt;p&gt;I made a very simplified test case example.&amp;nbsp; I made a connection to a SQL Server&amp;nbsp;database for a Filler Form, no managed code, no rules, form stays open on submit,&amp;nbsp;made it trusted, and included the 3 fields: &lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;id&lt;br /&gt;Submitted On&lt;br /&gt;Submitted By&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;The form looks like this after I fill in data&amp;nbsp;(sorry, I couldn&amp;#39;t figure out how to paste an image):&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;id: ___________&lt;/p&gt;&lt;p&gt;Submitted On: &lt;u&gt;2/12/2013&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/u&gt;&lt;/p&gt;&lt;p&gt;Submitted By: &lt;u&gt;This is me&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/u&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;When I clicked submit, the submission is successful and the form automatically updated, only I expect the id (primary key) to be populated with the next value in the table, 48.&amp;nbsp; Instead, the form refreshes with the record of id 46 as follows:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;id: &lt;u&gt;46&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; &lt;/u&gt;&lt;/p&gt;&lt;p&gt;Submitted On: &lt;u&gt;2/11/2013&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;                            &lt;/u&gt;&lt;/p&gt;&lt;p&gt;Submitted By: &lt;u&gt;rr&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;&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;&amp;nbsp;&amp;nbsp; &lt;/u&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;In this test form the difference in id is always 2 (I expected 48 but got 46).&amp;nbsp; In my original problem form the difference is always 5.&lt;/p&gt;&lt;p&gt;Can anyone explain this behavior?&amp;nbsp; Or more to the point, how can I get the form to update with the correct record that I just submitted?&lt;/p&gt;&lt;p&gt;Thanks&lt;/p&gt;&lt;p&gt;Tony&lt;/p&gt;</description></item><item><title>Getting New Primary Key Value After Initial Submit</title><link>https://www.infopathdev.com:443/forums/thread/86916.aspx</link><pubDate>Sat, 09 Feb 2013 02:12:23 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:86916</guid><dc:creator>abcolson</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/86916.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=86916</wfw:commentRss><description>&lt;p&gt;In InfoPath 2003, after submitting to a SQL database via code as &lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ADOAdapter2 adapter = GetDataAdapter(DOM_MAIN);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;adapter.Submit();&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;the IXMLDOMNode representing the primary key value would be automatically set.&amp;nbsp; This was handy as if I made a change and then re-submitted, the original record just created would be updated instead of a 2nd record being created.&lt;/p&gt;&lt;p&gt;With InfoPath 2010, I am trying to submit in code as&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;AdoSubmitConnection&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; submitter = (&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;AdoSubmitConnection&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;)DataConnections[DOM_MAIN_SUBMIT];&lt;br /&gt;&lt;/font&gt;&lt;font size="2"&gt;submitter.Execute();&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;font size="2"&gt;and the &amp;quot;id&amp;quot; attribute (representing the primary key) of my XPathNavigator does not get automatically set.&amp;nbsp; I have even tried re-creating the navigator with CreateNavigator() and no change.&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;Is this behavior by design?&amp;nbsp; Is this a departure from the behavior in IP 2003?&amp;nbsp; In any event, how am I supposed to capture/access the new value of the primary key after a new record is submitted?&amp;nbsp; (BTW, the attribute of &amp;quot;id&amp;quot; is &amp;quot;d:optional_long&amp;quot; in the schema).&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;Thank you&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;Tony&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;</description></item></channel></rss>