VB Constants in text strings
Posted on 2012-03-13
I use Visual Basic for SQL applications. Most of the queries are dynamic, lengthy, and complex. In Visual Studio 2005, I was able to construct the SQL statements with immbeded VB constants (eg. vbLf, vbTab). During debugging, I could then copy the string value and paste it into SQL Management Studio. The vb constants gave a formatted layout in SQLMS.
As a simple example:
dim strSql as string = "select a, b, c " + vbLf + "from xyz"
In Visual Studio 2010, the vb constants are ignored or replaced with blanks. As a result, the query in SQL is not formatted at all. The same occurs when I paste into Notepad. Therefore, the formatting is being lost during the Visual Studio copy, and not during the paste. I've tried all variants of the copy.
This isn't a huge problem, but it seems it should be easy to do. Any suggestions?