Create MySQL database using vb .net

cpopham

Well-known member
Joined
Feb 18, 2004
Messages
273
Create MySQL database using vb .net {RESOLVED}

Is there anyway to create a MySql database on an active server using a .net data provider? I have seen ways of creating a database using MS SQL server and Vb .net, but I am not sure if the same is possible using MySql and Vb .Net. Anyone hve any ideas?

Thanks, Chester
 
Last edited by a moderator:
If anyone is curious, is actually simple to create a new database on a myql server. You must have the right user privelges and then the code is as faollows.

Code:
yConStr = "Data Source=192.168.2.2;User Id=Admin;Pwd=my1;"
        Dim myConnection As New MySqlConnection(myConStr)
        Dim myNewDB As String = "CREATE DATABASE menagerie;"
        The following will DROP the database
        Dim mynewdb As String = "DROP DATABASE menagerie;"
        Dim myComm As New MySqlCommand(myNewDB)
        myComm.Connection = myConnection
        Try
            myConnection.Open()
            myComm.ExecuteNonQuery()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

Chester
 
Back
Top