<?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: Using Visual Basic code to execute stored procedures in SQL</title><link>https://www.infopathdev.com:443/forums/thread/62950.aspx</link><pubDate>Mon, 10 Jan 2011 00:55:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:62950</guid><dc:creator>ZhenYuan</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/62950.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=62950</wfw:commentRss><description>&lt;p&gt;Hi Josera,&lt;/p&gt;
&lt;p&gt;Thanks, will try that out for my next form. Thanks!&lt;/p&gt;</description></item><item><title>Re: Using Visual Basic code to execute stored procedures in SQL</title><link>https://www.infopathdev.com:443/forums/thread/62918.aspx</link><pubDate>Sat, 08 Jan 2011 09:33:11 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:62918</guid><dc:creator>josera</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/62918.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=62918</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi Zhen Yuan,&lt;/p&gt;&lt;p&gt;the &lt;b&gt;previous DB access command&lt;/b&gt; is the one that you defined when you selected Database as the main data source. It is used by your form to retrieve and store data from/to the main source database. If you don&amp;#39;t need to do any further retrieve or restore operation after you run the stored procedure, then you do not need to restore the previous DB access command.&lt;/p&gt;&lt;p&gt;&lt;b&gt;cn&lt;/b&gt; is an object variable so when you are done with it, the instruction &lt;b&gt;cn = nothing&lt;/b&gt;  destroys the object and frees up the memory it was taking up.&amp;nbsp; It also avoids memory errors that may show up keeping object variables longer than necessary.&lt;/p&gt;&lt;p&gt;Josera &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Using Visual Basic code to execute stored procedures in SQL</title><link>https://www.infopathdev.com:443/forums/thread/62892.aspx</link><pubDate>Fri, 07 Jan 2011 11:27:33 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:62892</guid><dc:creator>ZhenYuan</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/62892.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=62892</wfw:commentRss><description>&lt;p&gt;Hi Josera,&lt;/p&gt;
&lt;p&gt;Thanks for your reply! We have since took another approach for our forms but I will keep your advise in mind the next time I design another form. Being able to run stored procedures from the form is a very useful feature indeed.&lt;/p&gt;
&lt;p&gt;Just curious, is it a must to restore previous DB access command and set cn = nothing? Otherwise what will happen?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Zhen Yuan&lt;/p&gt;</description></item><item><title>Re: Using Visual Basic code to execute stored procedures in SQL</title><link>https://www.infopathdev.com:443/forums/thread/62891.aspx</link><pubDate>Fri, 07 Jan 2011 11:12:20 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:62891</guid><dc:creator>josera</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/62891.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=62891</wfw:commentRss><description>&lt;p&gt;Hi ZhenYuan,&lt;/p&gt;&lt;p&gt;I use VBScript instead of Visual Basic but perhaps this can help you because of the similarities. This is what works for me to run a stored procedure from Infopath 2007 in SQL Server 2008:&lt;/p&gt;&lt;p&gt;&amp;#39; Run the stored procedure [UpdateModifiedDay] in the DB&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dim cn&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set cn = XDocument.QueryAdapter&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dim originalCommand&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; originalCommand = cn.Command&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;#39; Save current DB access command&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cn.Command = &amp;quot;EXECUTE UpdateModifiedDay&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cn.Query&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cn.Command = originalCommand&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;#39; Restore previous DB access command&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set cn = nothing&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;In the stored procedure you have to add this instruction so it works from Infopath:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&amp;nbsp;SET implicit_transactions OFF;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;That&amp;#39;s all it takes. Hope it helps.&lt;/p&gt;&lt;p&gt;Josera &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Using Visual Basic code to execute stored procedures in SQL</title><link>https://www.infopathdev.com:443/forums/thread/61069.aspx</link><pubDate>Thu, 04 Nov 2010 10:23:40 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:61069</guid><dc:creator>ZhenYuan</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/61069.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=47&amp;PostID=61069</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;We are using Infopath 2007 and I&amp;#39;m having difficulty trying to code my form to run some stored procedures from my SQL server.&lt;/p&gt;
&lt;p&gt;What&amp;nbsp;I have in my button code is:&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Dim&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; myAdoQueryConnection &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;As&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; AdoQueryConnection = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;Me&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.DataConnections(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;DataConnection&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;myAdoQueryConnection.Command = &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;exec [formdb].[dbo].[SP_Delete_Folder]&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;myAdoQueryConnection.Execute()&lt;/p&gt;
&lt;p&gt;Before going into the details of this coding, can I check how I should configure my DataConnection? Right now, its a Receive data connection to SQL Database where I use Windows Authentication as login method. I randomly chose a table in my DB and is able to draw data from that table when my form is in preview mode. However, once I load the form into my server and run the form from DBXL, I am not able to retrieve any data from my table. Beats me why... &lt;/p&gt;
&lt;p&gt;That aside and assuming I have a solution for that, can I then use the code above to run my stored procedure SP_Delete_Folder? &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks in advance!&lt;/p&gt;&lt;/font&gt;</description></item></channel></rss>