With the following image I intend to explain myself in a better way.
My goal is to create an App similar to Query browser. (I do not know if it will be correct to say interpreter SQL simulator).
But when making the connection you must define to which database you want to connect, which prevents me from sending a "Create Database", I can only work within the database, so add the combobox to change the database .
Summing up: How can I execute a database creation statement from a textbox.
They asked me to show the code that I have been carrying so far, so here I leave it. I have it in a button that I added later although I would like it to be executed when pressing F5
Dim sentencia As String
sentencia = TextBox1.Text
TextBox3.Text = sentencia
Dim con As New SqlConnection(My.Settings.Conexion)
Dim sql As String = sentencia
Dim cmd As New SqlCommand(sql, con)
Try
Dim da As New SqlDataAdapter(cmd)
Dim ds As New DataSet
da.Fill(ds, "Tabla1")
Me.DataGridView1.DataSource = ds.Tables("Tabla1")
Catch ex As Exception
MsgBox(ex.Message)
TextBox3.Text = ex.Message
End Try
End Sub