Hi i got the same error, when i am trying to populate the repeat tables to sharepoint list,
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Microsoft.Office.InfoPath.Server.SolutionLifetime.DataAdapters.get_Item(String name)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.DataAdapters.EnsureDataAdapter(String name)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.DataAdapters.get_Item(String name)
at Microsoft.Office.InfoPath.Server.DocumentLifetime.DataConnectionCollectionHost.<>c__DisplayClass4.b__3()
at Microsoft.Office.InfoPath.Server.DocumentLifetime.OMExceptionManager.ExecuteOMCallWithExceptions(OMCall d, ExceptionFilter exceptionFilter)
I have a event handler in the internal startup fucntion,
((ButtonEvent)EventManager.ControlEvents["Submit"]).Clicked += new ClickedEventHandler(Submit_Clicked);
And also the location i am supplying this way,
FileSubmitConnection SubmitConnection = (FileSubmitConnection)this.DataConnections["Main submit"];
SubmitConnection.FolderUrl = LibLocation.Substring(0, LibLocation.LastIndexOf("/"));
SubmitConnection.Execute();
there is a weird thing happening, when i submit the form for the first time, only the first row of the repeater table is saved, with the above error, then if i save the same form with out closing, i am able to save all the rows to the SP list,
Please suggest me what should i do to save all the rows in the first time and not get this error,
Thanks in advance :)