Is there something better than a StringBuilder for big blocks of SQL in the code

Posted by Eduardo Molteni on Programmers See other posts from Programmers or by Eduardo Molteni
Published on 2011-06-22T21:07:33Z Indexed on 2011/06/23 0:31 UTC
Read the original article Hit count: 325

Filed under:
|

I'm just tired of making a big SQL statement, test it, and then paste the SQL into the code and adding all the sqlstmt.append(" at the beginning and the ") at the end.

It's 2011, isn't there a better way the handle a big chunk of strings inside code?

Please: don't suggest stored procedures or ORMs.

edit Found the answer using XML literals and CData. Thanks to all the people that actually tried to answer the question without questioning me for not using ORM, SPs and using VB

edit 2 the question leave me thinking that languages could try to make a better effort for using inline SQL with color syntax, etc. It will be cheaper that developing Linq2SQL.

Just something like:

dim sql = <sql>
          SELECT * ...
          </sql>

© Programmers or respective owner

Related posts about coding-style

Related posts about vb.net