Create The Database
Creating a database in VB.NET is relatively straight forward. The key is to know the SQL code to create the database. With this we can create a SqlConnection to our Sql Server (using our connection string above), Create a Sql Command, and execute the SQL code to create the Database.
You can see an example of this in our VB.NET Source sample’s CreateDatabase Subroutine (around line 55):
Dim sqlStatement As String = _
"IF EXISTS (" & _
"SELECT * " & _
"FROM master..sysdatabases " & _
"WHERE Name = 'HowToDemo')" & vbCrLf & _
"DROP DATABASE HowToDemo" & vbCrLf & _
"CREATE DATABASE HowToDemo"
Dim connection As New SqlConnection(connectionString)
' A SqlCommand object is used to execute the SQL commands.
Dim cmd As New SqlCommand(sqlStatement, connection)
It might not be best to resurect three year old threads, secondly the OP (and this category) was referencing Java, not VB.