<?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: Error during submission to a SQL Server database</title><link>https://www.infopathdev.com:443/forums/thread/30310.aspx</link><pubDate>Fri, 11 Jul 2008 01:04:14 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:30310</guid><dc:creator>Marian</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/30310.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=30310</wfw:commentRss><description>&lt;p&gt;Yes they both have Primary Keys set as Autonumber fields.&amp;nbsp; The tblPendingLeaveDetail child table also has a field named ParentID that is set equal to the ID Autonumber field in the tblPendingLeave parent table.&amp;nbsp; The Data Connection shows that it knows the 2 tables are Parent Child and are linked by ID field in tblPendingLeave = ParentID field in tblPendingLeaveDetail&lt;/p&gt;
&lt;p&gt;&amp;nbsp;So I am creating records similar to below.&lt;/p&gt;
&lt;p&gt;tblPendingLeave - Primary Key field = ID&lt;/p&gt;
&lt;p&gt;If the parent records ID field =&amp;nbsp;say 1230, then the child table -&amp;nbsp;&amp;nbsp;tblPendingLeaveDetail would have records with a value of 1230 in its ParentID field and its Primary Key ID field set automatically by the SQL Server to the next number.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;As I stated earlier, if I remove the vb code that automatically add the repeating table entries and instead add them manually, then the Submit works every time.&amp;nbsp; I only get the error if use the code I showed to add the records. &lt;/p&gt;
&lt;p&gt;Also, I should mention that if only 1 table entry is created by the code because the user only asks for 1 day off, then the Submit works each time as well.&amp;nbsp; The Submit only fails if there is more than 1 repeating table entry added via the vb code.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Error during submission to a SQL Server database</title><link>https://www.infopathdev.com:443/forums/thread/30309.aspx</link><pubDate>Fri, 11 Jul 2008 00:24:40 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:30309</guid><dc:creator>oldradio99</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/30309.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=30309</wfw:commentRss><description>&lt;p&gt;do both of your tables have primary keys set?&lt;/p&gt;</description></item><item><title>Error during submission to a SQL Server database</title><link>https://www.infopathdev.com:443/forums/thread/30300.aspx</link><pubDate>Thu, 10 Jul 2008 20:18:40 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:30300</guid><dc:creator>Marian</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/30300.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=44&amp;PostID=30300</wfw:commentRss><description>&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;I have a IP 2003 form that is used to request leave time.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;This form is tied to 2 tables in SQL Server, a parent table (tblPendingLeave) with an Autonumber ID field as the Primary Key and a child table (tblPendingLeaveDetail) with an Autonumber ID field as the Primary Key with ParentID linked to the parent table’s ID field as a Foreign Key.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;The form’s repeating table data source is tblPendingLeaveDetail.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;It has its number of rows added programmatically using Visual Studio 2005 vb based on the number of days off requested.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;So if the employee asks for vacation from 7/16 to 7/18, the vb code inserts 3 detail records where the user can enter additional information for each day.&lt;/font&gt;&lt;/p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;When the user clicks on the Submit button, the following error is displayed.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; (I am using an ADODataAdapter to do the submission).&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;System.Runtime.InteropServices.COMException&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;InfoPath cannot submit the form.&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;An error occurred while the form was being submitted.&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;The parameter is incorrect.&lt;/font&gt;&lt;/p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;at Microsoft.Office.Interop.InfoPath.SemiTrust.ADOAdapter2.Submit()&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;at Microsoft.Office.Interop.InfoPath.SemiTrust.ADOAdapterObjectWrapper.Submit()&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;at LeaveForm.LeaveForm.OnSubmitRequest(DocReturnEvent e)&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnSubmitRequest(DocReturnEvent pEvent)&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;By leaving the form open, I can see that the ParentID field of the first row in the repeating table is filled in correctly but the following rows are not filled in even though I have set the ParentID field to default to the ID field assigned to the new record in tblPendingLeave.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;If the user clicks on the OK button to close the error message and then clicks on the Submit button again the data is submitted successfully.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;With the form open, I can see that it has deleted all of the detail rows except for the first one and shows the ParentID of the record that was just inserted into the tblPendingLeave table and the ID of the first record inserted into tblPendingLeaveDetail.&lt;/font&gt;&lt;/p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;If I remove the code to insert the rows into the repeating table and manually add them, the system will insert the records into the 2 SQL Server tables with no problem.&lt;/font&gt;&lt;/p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;font size="3"&gt;&lt;font face="Times New Roman"&gt;Below is a portion of the code I have tried.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;I have tried both the new code and the old code shown below and both give the same problem.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;font face="Times New Roman" size="3"&gt;What am I doing wrong?&lt;/font&gt;&lt;/p&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;If&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt; &lt;span style="COLOR:blue;"&gt;CDate&lt;/span&gt;(NextDate) &amp;lt;= &lt;span style="COLOR:blue;"&gt;CDate&lt;/span&gt;(toDate) &lt;span style="COLOR:blue;"&gt;Then&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&amp;#39;New code to insert lines into the repeating table&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;thisXDocument.View.ExecuteAction(&lt;span style="COLOR:#a31515;"&gt;&amp;quot;xCollection::insert&amp;quot;&lt;/span&gt;, &lt;span style="COLOR:#a31515;"&gt;&amp;quot;tblPendingLeaveDetail_7&amp;quot;&lt;/span&gt;)&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&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;/span&gt;&lt;span style="COLOR:green;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;With&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt; thisXDocument.DOM&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;thisXDocument.DOM.selectSingleNode(&lt;span style="COLOR:#a31515;"&gt;&amp;quot;/dfs:myFields/dfs:dataFields/d:tblPendingLeave/d:tblPendingLeaveDetail[last()]/@LeaveDate&amp;quot;&lt;/span&gt;).text = NextDate.ToString(&lt;span style="COLOR:#a31515;"&gt;&amp;quot;yyyy-MM-dd&amp;quot;&lt;/span&gt;)&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;End&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt; &lt;span style="COLOR:blue;"&gt;With&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&amp;#39;Old Code to automatically insert the detail row&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;newChild = thisXDocument.DOM.selectSingleNode(&lt;span style="COLOR:#a31515;"&gt;&amp;quot;/dfs:myFields/dfs:dataFields/d:tblPendingLeave/d:tblPendingLeaveDetail&amp;quot;&lt;/span&gt;)&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;cloneNode = newChild.cloneNode(&lt;span style="COLOR:blue;"&gt;True&lt;/span&gt;)&lt;span style="mso-spacerun:yes;"&gt;&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;/span&gt;thisXDocument.DOM.selectSingleNode(&lt;span style="COLOR:#a31515;"&gt;&amp;quot;/dfs:myFields/dfs:dataFields/d:tblPendingLeave&amp;quot;&lt;/span&gt;).appendChild(cloneNode)&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;thisXDocument.DOM.selectSingleNode(&lt;span style="COLOR:#a31515;"&gt;&amp;quot;/dfs:myFields/dfs:dataFields/d:tblPendingLeave/d:tblPendingLeaveDetail[last()]/@LeaveDate&amp;quot;&lt;/span&gt;).text = NextDate.ToString(&lt;span style="COLOR:#a31515;"&gt;&amp;quot;yyyy-MM-dd&amp;quot;&lt;/span&gt;)&lt;/span&gt;&lt;font face="Times New Roman" size="3"&gt;&amp;nbsp;&lt;/font&gt;&lt;span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;End&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt; &lt;span style="COLOR:blue;"&gt;If&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&amp;nbsp;&lt;/span&gt; 
&lt;p class="MsoNormal" style="MARGIN:0in 0in 0pt;"&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;The code then adds 1 to the NextDate variable and cycles until it reaches the toDate, which is the Ending Date entered by the user.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>