I know this is an old post, but there were not many good answers. I had the same question and found this solution for VB6 on VBForums by si_the_geek - one of their super moderators.
VB Forums Topic for formatting SQL Select (VB6)
Working with VB6 and VB.NET, it was easy to convert. There is a VB.NET link at the bottom of the stream, or you can get to it right here:
VB.NET SQL Formatter
You can be able to convert this to C # using one of the online conversion tools without any problems.
We will warn, however, that the library is not commercial code β it works very well for fairly simple SELECTs. For a complex SQL statement with several subselections, I found errors in the resulting SQL.
Best wishes,
David
ps. Oh yes ... it's FREE! :)
David carta
source share