<?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: Deleteing/Inserting Rows into DB From Infopath Codebehind</title><link>https://www.infopathdev.com:443/forums/thread/89291.aspx</link><pubDate>Fri, 26 Apr 2013 16:07:51 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:89291</guid><dc:creator>RobSil1976</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/89291.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=89291</wfw:commentRss><description>&lt;p&gt;That got it!&amp;nbsp; I had a literal transaction in my other SP I was invoking, this one I had missed adding that.&amp;nbsp; Thanks a bunch Hilary! &lt;/p&gt;&lt;p&gt;&amp;nbsp;Now to try to do inserts via a SP....&lt;/p&gt;&lt;p&gt;Update: Insert SP worked the exact same, but I didn&amp;#39;t need the Implicit trxn off statement.&amp;nbsp; Removed that line, changed my SP to use insert vs. delete and added wayyyyyyyy more params and it seemed to work.&amp;nbsp; &lt;/p&gt;</description></item><item><title>Re: Deleteing/Inserting Rows into DB From Infopath Codebehind</title><link>https://www.infopathdev.com:443/forums/thread/89290.aspx</link><pubDate>Fri, 26 Apr 2013 15:52:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:89290</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/89290.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=89290</wfw:commentRss><description>&lt;p&gt;I&amp;#39;d be more interested in the text of the stored proc. Are you setting implicit transactions off in&amp;nbsp;it?&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Deleteing/Inserting Rows into DB From Infopath Codebehind</title><link>https://www.infopathdev.com:443/forums/thread/89289.aspx</link><pubDate>Fri, 26 Apr 2013 15:46:22 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:89289</guid><dc:creator>RobSil1976</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/89289.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=89289</wfw:commentRss><description>&lt;p&gt;Going back to the SP suggestion... this seems to also not want to work.&amp;nbsp; There must be something very obvious I am just missing that is going on.&amp;nbsp; if I copy out the results of the trace and run in SSMS, it works but for some reason it won&amp;#39;t work when comming in from my form.&amp;nbsp; Hilary can you see anything wrong with this query string?&lt;/p&gt;

&lt;font size="2"&gt;
&lt;pre&gt;    string query = &amp;quot;DECLARE	@return_value int, @poNum varchar(25) &amp;quot; +
                    &amp;quot;EXECUTE @return_value = [dbo].[spDeleteCodingElementsByPONum] @poNum = &amp;#39;&amp;quot; + currPONum + &amp;quot;&amp;#39;;&amp;quot;;
              
            AdoQueryConnection myAdoQueryConnection =
                 (AdoQueryConnection)(this.DataConnections[&amp;quot;ELECTRONIC_PO&amp;quot;]);
            string oldCmd = myAdoQueryConnection.Command;
            myAdoQueryConnection.Command = query;
            myAdoQueryConnection.Execute();
            myAdoQueryConnection.Command = oldCmd;

&lt;/pre&gt;
&lt;/font&gt;</description></item><item><title>Re: Deleteing/Inserting Rows into DB From Infopath Codebehind</title><link>https://www.infopathdev.com:443/forums/thread/89288.aspx</link><pubDate>Fri, 26 Apr 2013 15:20:14 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:89288</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/89288.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=89288</wfw:commentRss><description>&lt;p&gt;Yes, you&amp;#39;d want to sign it or install it on each machine - if installed on each machine, you need to make sure the users install the latest when you have changes. Here&amp;#39;s&amp;nbsp;a &lt;a href="http://www.infopathdev.com/blogs/mel_balsamo/archive/2011/07/11/how-to-create-a-digital-certificate-and-publish-a-signed-template-to-the-dbxl-admin-tool.aspx"&gt;link&lt;/a&gt; to using full trust forms w/ DBXL. &lt;/p&gt;</description></item><item><title>Re: Deleteing/Inserting Rows into DB From Infopath Codebehind</title><link>https://www.infopathdev.com:443/forums/thread/89286.aspx</link><pubDate>Fri, 26 Apr 2013 15:11:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:89286</guid><dc:creator>RobSil1976</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/89286.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=89286</wfw:commentRss><description>&lt;p&gt;What are the implications of doing that?&amp;nbsp; I see that it needs to be &amp;quot;installed or digitally signed&amp;quot;... I don&amp;#39;t have a cert, but the form itself is only intended for 1-2 admin users, is it hard to install it onto a system?&lt;/p&gt;&lt;p&gt;R.&lt;/p&gt;</description></item><item><title>Re: Deleteing/Inserting Rows into DB From Infopath Codebehind</title><link>https://www.infopathdev.com:443/forums/thread/89285.aspx</link><pubDate>Fri, 26 Apr 2013 15:05:18 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:89285</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/89285.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=89285</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Sure, if you make the form full trust. The reason to use existing data connections is to not have to be full trust.&lt;/p&gt;</description></item><item><title>Re: Deleteing/Inserting Rows into DB From Infopath Codebehind</title><link>https://www.infopathdev.com:443/forums/thread/89284.aspx</link><pubDate>Fri, 26 Apr 2013 15:01:32 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:89284</guid><dc:creator>RobSil1976</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/89284.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=89284</wfw:commentRss><description>&lt;p&gt;I may have to go that route.&amp;nbsp;&amp;nbsp; Have you ever done inserts via a SP&amp;nbsp;also?&amp;nbsp; (I ran a quick test of a subsequent insert statement and same thing, no sign of it executing on the server.)&amp;nbsp; &lt;/p&gt;&lt;p&gt;Alternatively, does Infopath support using a straight SqlConnection in it&amp;#39;s code behind?&lt;/p&gt;
&lt;p&gt;Something along the lines of:&lt;/p&gt;
&lt;pre&gt;                using (SqlConnection connection = new SqlConnection(
                           &amp;quot;Data Source=dbsrvr;Initial Catalog=dbname;User Id=usr;Password=pwd;&amp;quot;))
                {
                    SqlCommand command = new SqlCommand(&amp;quot;delete from table&amp;quot;, connection);
                    command.Connection.Open();
                    command.ExecuteNonQuery();
                }

&lt;/pre&gt;</description></item><item><title>Re: Deleteing/Inserting Rows into DB From Infopath Codebehind</title><link>https://www.infopathdev.com:443/forums/thread/89279.aspx</link><pubDate>Fri, 26 Apr 2013 14:51:05 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:89279</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/89279.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=89279</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;I went and took a look at the form where I&amp;#39;d implemented this - I used a stored procedure (I was deleting from 3 tables), and set my data connection to execute it. Looking at my DB - there was nothing special about it either, though in the stored proc I do set implicit_transactions off.&lt;/p&gt;</description></item><item><title>Re: Deleteing/Inserting Rows into DB From Infopath Codebehind</title><link>https://www.infopathdev.com:443/forums/thread/89278.aspx</link><pubDate>Fri, 26 Apr 2013 14:39:18 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:89278</guid><dc:creator>RobSil1976</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/89278.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=89278</wfw:commentRss><description>Additionally, if I change my sql statement from a DELETE FROM, to a select * from, the query works (e.g. the where clause is valid, it can see the DB just fine, etc.).&amp;nbsp; It seems like Infopath does not like deleting using this DataSource.&amp;nbsp; Is there something special I have to do to the datasource to have it allow deletes?&amp;nbsp;</description></item><item><title>Re: Deleteing/Inserting Rows into DB From Infopath Codebehind</title><link>https://www.infopathdev.com:443/forums/thread/89277.aspx</link><pubDate>Fri, 26 Apr 2013 14:27:17 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:89277</guid><dc:creator>RobSil1976</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/89277.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=89277</wfw:commentRss><description>&lt;p&gt;Trace shows me that the commands are running on the server, but nothing is changing.&amp;nbsp;&amp;nbsp; I copy the SQL out of the BatchStarting and run it in SSMS and the row will delete.&amp;nbsp; The results of my sql in the trace look like:&lt;/p&gt;&lt;p&gt;SQL:BatchStarting: set implicit_transactions on SET NO_BROWSETABLE ON&amp;nbsp; (then a batch completed)&lt;/p&gt;&lt;p&gt;SQL:BatchStarting: DELETE FROM [dbo].[MyTable] WHERE MyKey=&amp;#39;TestKey&amp;#39;&amp;nbsp; (then a batch completed)&lt;/p&gt;&lt;p&gt;SQL:BatchStarting: IF @@TRANCOUNT &amp;gt; 0 ROLLBACK TRAN (then a batch completed)&lt;/p&gt;&lt;p&gt;&amp;nbsp;If the SQL in the 2nd batch statement executes fine in a query window, I am assuming that the 3rd batch statement to rollback tran never happens... bit puzzling.&amp;nbsp; Any further thoughts?&lt;/p&gt;&lt;p&gt;R.&lt;/p&gt;</description></item><item><title>Re: Deleteing/Inserting Rows into DB From Infopath Codebehind</title><link>https://www.infopathdev.com:443/forums/thread/89258.aspx</link><pubDate>Thu, 25 Apr 2013 22:33:43 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:89258</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/89258.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=89258</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Can you run a SQL trace to get some insight into what might be going wrong? I know with stored procs we have to set implicit_transactions off to get them to execute correctly from IP.... but running a trace should help you see what&amp;#39;s going on.&lt;/p&gt;</description></item><item><title>Deleteing/Inserting Rows into DB From Infopath Codebehind</title><link>https://www.infopathdev.com:443/forums/thread/89245.aspx</link><pubDate>Thu, 25 Apr 2013 18:04:27 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:89245</guid><dc:creator>RobSil1976</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/89245.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=89245</wfw:commentRss><description>&lt;p&gt;Just wondering if anyone can point me at how to do this?&amp;nbsp; I am unable to create a connection that will let me do more than query the DB.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;From this post by Hilary:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.infopathdev.com/blogs/hilary/archive/2009/10/13/use-dbxl-submit-with-existing-sql-data.aspx"&gt;http://www.infopathdev.com/blogs/hilary/archive/2009/10/13/use-dbxl-submit-with-existing-sql-data.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I read the last paragraph:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;An Alternate Route&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;For the programmer, or if you don&amp;#39;t mind the maintenance costs of adding code to your forms, there are other alternatives. For example, you can use custom code for your submit that will run a stored procedure or SQL statement to delete any rows that have the same ID as the data loaded into your form prior to the web service submit. This works well for data that has been using unique identifiers for keys.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Which makes me think it can be done but my sampling does not make it readily apparent.&amp;nbsp; I have tried this:&lt;/p&gt;
&lt;pre&gt;  string deleteTableQry = &amp;quot;DELETE FROM [dbo].[MyTable] WHERE MyKey=&amp;#39;&amp;quot; + someKeyVar + &amp;quot;&amp;#39;&amp;quot;;

            AdoQueryConnection myAdoQueryConnection =
                 (AdoQueryConnection)(this.DataConnections[&amp;quot;DB_CONNECTION_TO_MYDB&amp;quot;]);
            string oldCmd = myAdoQueryConnection.Command;
            myAdoQueryConnection.Command = deleteTableQry;
            myAdoQueryConnection.Execute();
            myAdoQueryConnection.Command = oldCmd;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;The command runs but doesn&amp;#39;t seem to change anything in the DB.  &lt;/pre&gt;&lt;pre&gt;Anyone with suggestions?&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;Thx,&lt;/pre&gt;&lt;pre&gt;Rob&lt;/pre&gt;</description></item></channel></rss>