# Create Database with vb.net



## shuggans (Dec 24, 2011)

I'm trying to create a database programmatically with vb.net.  I can't seem to get anything to work.  This is the farthest working I've got so far.  Any ideas?


```
Dim ConnectionCreateDB As New SqlConnection
        ConnectionCreateDB.ConnectionString = "Data Source=HERMES\VFVMSDBSERVER;Initial Catalog=;User ID=sa;Password=Pass1;"
        Dim String_CreateDB As String = "create database vfvmsdb; go"
        Dim Command_CreateDB As New SqlCommand
        Command_CreateDB.Connection = ConnectionCreateDB
        ConnectionCreateDB.Open()
        If ConnectionCreateDB.State = ConnectionState.Open Then
            MessageBox.Show("Good")
            Try
                Command_CreateDB.ExecuteNonQuery()
                Command_CreateDB.Dispose()
                ConnectionCreateDB.Close()
                ConnectionCreateDB.Dispose()
            Catch
                MessageBox.Show("create DB command bad")
            End Try
        End If
```


----------



## Kreij (Dec 25, 2011)

Take a look at this


----------

