There are three types of infopath form in SharePoint
- List level (customizing the existing list)
- Content type based infopath and
- Farm level infopath Full trusted solution.
In the above three vsta custom code is allowed in farm level and content type based infopath, I mean those form we develop from the scratch using the infopath designer.
In this case, we can write the visual studio coding the way we do traditional coding to get connected in SQL server and call the stored procedure. Otherwise, we develop a custom web service for the SQL integration functionality and we can call that in the infopath form.
With these being said, for your scenario instead of maintaining multiple forms to store and display the SQL integrated data, I would suggest to go with creating an external list which can seamlessly connect to the SQL table for the CRUD operation, then you can create multiple views to display the data in the same list.