<?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>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: New to Infopath with a question on managed code</title><link>https://www.infopathdev.com:443/forums/thread/55133.aspx</link><pubDate>Thu, 20 May 2010 15:53:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:55133</guid><dc:creator>Flanker</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/55133.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=55133</wfw:commentRss><description>&lt;p&gt;I had tried that code already, it compiles and executes without error and even the &amp;#39;From submitted successfully&amp;quot;&amp;nbsp;message displays,&amp;nbsp; except that it does not update the database.&amp;nbsp; I guess this is not possible to update the sql database using managed code using&amp;nbsp;Microsoft.Office.InfoPath namespace classes and methods?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: New to Infopath with a question on managed code</title><link>https://www.infopathdev.com:443/forums/thread/55100.aspx</link><pubDate>Thu, 20 May 2010 06:04:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:55100</guid><dc:creator>Qazi Anis</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/55100.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=55100</wfw:commentRss><description>&lt;p&gt;try this.DataConnections[&amp;quot;Main connection&amp;quot;].Execute(); &lt;/p&gt;&lt;p&gt;&amp;nbsp;if that doesnt work check &lt;a href="http://www.infopathdev.com/forums/p/15517/55066.aspx#55066%20"&gt;this&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: New to Infopath with a question on managed code</title><link>https://www.infopathdev.com:443/forums/thread/55058.aspx</link><pubDate>Wed, 19 May 2010 15:42:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:55058</guid><dc:creator>Flanker</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/55058.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=55058</wfw:commentRss><description>&lt;p&gt;I add the code as you suggest, but when I step through in debug, the fc.Execute() is never executed. I get a system error message &amp;quot;Infopath cannot submit the form. The OnSubmitRequest event handler returned a value indicating that the submit failed.&amp;quot; &lt;/p&gt;
&lt;p&gt;my code is this;&lt;/p&gt;
&lt;p&gt;try{ &lt;/p&gt;
&lt;p&gt;FileSubmitConnection fc = (FileSubmitConnection)this.DataConnections[&amp;quot;Main submit&amp;quot;]; &lt;/p&gt;
&lt;p&gt;fc.Execute(); // this statement code never getting executed&lt;br /&gt;e.CancelableArgs.Cancel=false;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;catch{&lt;/p&gt;
&lt;p&gt;e.CancelableArgs.Cancel=true;&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;</description></item><item><title>Re: New to Infopath with a question on managed code</title><link>https://www.infopathdev.com:443/forums/thread/55054.aspx</link><pubDate>Wed, 19 May 2010 15:15:12 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:55054</guid><dc:creator>Qazi Anis</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/55054.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=55054</wfw:commentRss><description>&lt;p&gt;use&amp;nbsp;&lt;/p&gt;&lt;p&gt; FileSubmitConnection fc = (FileSubmitConnection)this.DataConnections[&amp;quot;Main submit&amp;quot;];&lt;/p&gt;&lt;p&gt;fc.Execute(); &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: New to Infopath with a question on managed code</title><link>https://www.infopathdev.com:443/forums/thread/55052.aspx</link><pubDate>Wed, 19 May 2010 15:03:23 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:55052</guid><dc:creator>Flanker</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/55052.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=55052</wfw:commentRss><description>&lt;p&gt;Thanks Qazi,&lt;/p&gt;
&lt;p&gt;But what is the correct code to use to submit my main connection,&amp;nbsp; up to this point I have not been successful except submitting the email connection.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description></item><item><title>Re: New to Infopath with a question on managed code</title><link>https://www.infopathdev.com:443/forums/thread/55016.aspx</link><pubDate>Wed, 19 May 2010 06:36:24 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:55016</guid><dc:creator>Qazi Anis</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/55016.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=55016</wfw:commentRss><description>&lt;p&gt;when&amp;nbsp;we use&amp;nbsp;managed code to submit the form, it is our responsibility to let the form know whether the submittion was sucessfull or not. we do this by settign the &lt;/p&gt;
&lt;p&gt;CancelableArgs.Cancel to true or false.&lt;/p&gt;
&lt;p&gt;try getting both the submits in only one try, so that if one fails the other doesnt execute. also no need to set the cancelableargs.cancel to true.&lt;/p&gt;</description></item><item><title>New to Infopath with a question on managed code</title><link>https://www.infopathdev.com:443/forums/thread/54988.aspx</link><pubDate>Tue, 18 May 2010 17:20:38 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:54988</guid><dc:creator>Flanker</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/54988.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=54988</wfw:commentRss><description>&lt;p&gt;I have a form with 2 data connections, email and sql database. On submitting the form using the submit button on the toolbar it works just fine.&amp;nbsp;&amp;nbsp;I use &amp;#39;custom action rules&amp;#39; in the submit options.&amp;nbsp; Also a&amp;nbsp;pop up message is&amp;nbsp;displayed (using C# managed code that is triggered when one of the required fields on the form is filled out),&amp;nbsp;once the user clicks the ok button on the pop up message both data connections then submit just fine.&amp;nbsp; That is the flow and what I want.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My problem is now I must add a submit button to the form itself while maintaining the same flow as above.&amp;nbsp;&amp;nbsp;The submit button on the form works just fine when submitting the email and sql data sources using&amp;nbsp;the &amp;#39;rules and custom code&amp;#39; option.&amp;nbsp; &lt;strong&gt;But when I try to display the pop up message before submitting the form, I have to click the submit button twice, once to generate the pop up message and once to submit the data connections.&amp;nbsp;&lt;/strong&gt; &amp;nbsp;Also the &amp;quot;form submitted successfully&amp;quot; message is not being displayed&amp;nbsp;when the form is submitted to the sql database.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;The control flow of the form behaves&amp;nbsp;differently when using the submit button on the toolbar versus using&amp;nbsp;a&amp;nbsp;submit button on the form.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;My solution was to use the &amp;#39;submit&amp;#39; action on the button property on the form and do this entirely in managed code, C# using the &amp;#39;Perform custom action using Code&amp;#39;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;nbsp;can display the pop up message, then send the email but &lt;strong&gt;am unable to submit to the&amp;nbsp;sql database&lt;/strong&gt; even though I get the&amp;nbsp;&amp;nbsp;&amp;quot;form submitted successfully&amp;quot;.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Here is the code for the&amp;nbsp;data connections;&lt;/p&gt;
&lt;p&gt;EmailSubmitConnection ec = (EmailSubmitConnection)(this.DataConnections[&amp;quot;Email Submit&amp;quot;]);&amp;nbsp;&lt;/p&gt;
&lt;p&gt;DataConnection mc = (DataConnection)this.DataConnections[&amp;quot;Main connection&amp;quot;];&lt;/p&gt;
&lt;p&gt;try{ ec.Execute(); e.CancelableArgs.Cancel = false;} catch {e.CancelableArgs.Cancel = true;}&lt;/p&gt;
&lt;p&gt;try{ mc.Execute(); e.CancelableArgs.Cancel = false;} catch {e.CancelableArgs.Cancel = true;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Any help will be greatly appreciated, Sorry I don&amp;#39;t know how to use the tags yet.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>