I was getting a little tired of manually adding datasources and when you have a form that needs over 100 datasources it can take a long time and get very repetitive trying to add them manually.
So, I wrote a script to do it for me.
The original script was 10x more primitive than this one, but I spent today cleaning it up for a typical use user by adding interfaces and input checks.
Simply export your form as source files, point the script to the directory you exported the infopath source to and enter in the asked information.
This was tested on Infopath 2007. I haven't had a lot of time to try every datatype, but Boolean did get mad when I didn't add the nilable parameter to the line, so I fixed that.
This is a very rough script and I haven't had a lot of time to sand out the edges, but it should work with relative ease.
http://www.mediafire.com/?q7e2ninae534ikc
Please let me know any bugs/your comments/thoughts on this script.