I'm looking for a simple tool for sql formatting. For example:
SELECT
Something
FROM
Sometable
is going to be converted as (for vb):
MyVar = "SELECT " & _
"Something " & _
"FROM " & _
"Sometable "
Does anyone know any online tool for this?
Thanks..
If you're simply looking for a solution to convert a multi-line query to VB.NET's string format, this solution doesn't need to be specific to SQL.
You could use a VS Macro, such as this one, for converting the string to VB.NET format, and adding the appropriate & _
characters.
If you're looking for an online tool, this page converts C# code to VB.NET code. If you simply enter a string in C# format, such as:
@"SELECT
Something
FROM
Sometable"
The tool will create the following VB.NET string:
"SELECT " & vbCr & vbLf & " Something" & vbCr & vbLf & "FROM" & vbCr & vbLf & " Sometable"
XML Literals work awesomely if you just want to include the query exactly in your code:
Dim s As String = <a><![CDATA[
SELECT
Something
FROM
Sometable
]]></a>.Value
I found this method by searching for a way to do multiline strings in vb. The best answer is here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With