Is there something better than a StringBuilder for big blocks of SQL in the code
- by Eduardo Molteni
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>