Note that for a database connection in InfoPath 2007, there is a separate name for the submit connection. To get this name, modify the data connection from tools-->data connections, and walk through the wizard to the finish page - you'll see two names there - one for the query connection, and one for the submit connection. To execute the submission, you'll need to use the code above, and use the name of the submit connection.
Thanx a lot for this post, it was absolutly helpfull for us!
I have two database connections in my infopath form. However, since there is a many-to-one relation between the tables, I cannot submit data through Infopath.
I am trying to submit data through code but its not working. Can someone please help?