Hi,
You can certainly write your own code (web services to do this). However it may you some time.
There is another alternative which is to use our DBXL Services:
http://www.qdabra.com/en/products/DBXL.aspx
For a very small fee you can purchase the Beginner license and have both our AD Web Services (ADWS) and our SQL Query (DBXL Data Query) services. Once you have the web serivce installed and configured you can then use it with as many InfoPath forms as you need, it's a generic service.
I realize you might be looking for some coding tips on here or where to start if you build this yourself but you should know there are off the shelf products out there already that will save you time!
Ted