I’m trying to make a simple tool to format SQL code so that I can use it in VB.
When I put in the following:
USE master
CREATE DATABASE netGuest
GO
I get…
"USE master" & vbCrLf & _"
CREATE DATABASE netGuest" & vbCrLf & _"
GO" & vbCrLf & _"
So it almost works. Really the only thing not working is that the lines are ending with the " rather than starting with them.
Here’s my code:
Protected Sub btnConvert_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnConvert.Click
If txtVB.Text IsNot Nothing Then : txtVB.Text = "" : End If
Dim input() As String = txtSQL.Text.Split(vbCrLf)
For i As Integer = 0 To UBound(input) - 1
txtVB.Text = """" & input(i) & """ & vbCrLf & _"
Next
End Sub
Thanks in advance for the help.
It’s because the split is not cutting of the vbCrLf but leave it there.
try this.