I have a button that has custom code which sends the form data to a database. When I build the custom code, I receive the following error when I click the 'Submit' button.
Things that I have checked:
- I don't have any errors in the code.
- I have tried all 3 trust levels in the 'Security and Trust' settings of the InfoPath form itself.
System.Security.SecurityException 
That assembly does not allow partially trusted callers.
   at InfoPath_FormNAme.FormCode.btnSubmit_Clicked(Object sender, ClickedEventArgs e) 
   at Microsoft.Office.InfoPath.Internal.ButtonEventHost.OnButtonClick(DocActionEvent pEvent)
   at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)
 
                        
I did have to set the Security Level to 'Full' in order to get the button to work.