Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

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

Edited by cpopham

____________________________________________

http://www.pophamcafe.com

I am starting a developers section, more tutorials than anything.

Posted

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.

 

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

____________________________________________

http://www.pophamcafe.com

I am starting a developers section, more tutorials than anything.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...