Hi,
Below code, I have passed the text box value as database name,
Private Sub btnCreateDataBase_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreateDataBase.Click
Dim conStr As String = "Server=Myserver;Database=;Trusted_Connection = yes"
Dim objCon As New SqlConnection(conStr)
Dim obj As SqlCommand
Dim strSQL As String
objCon.Open()
obj = objCon.CreateCommand()
strSQL = "CREATE DATABASE _" + TextBox1.text
obj.CommandText = strSQL
Try
obj.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
objCon.Close()
objCon = Nothing
End Sub