VB.net Program to Create a Table in Mysql Database Dynamically

You are currently viewing VB.net Program to Create a Table in Mysql Database Dynamically

VB.Net program to create a table in MySql database dynamically

'VB.NET program to create a table in 
'MySql database dynamically.

Imports MySql.Data.MySqlClient

Module Module1
    Sub Main()
        Dim connString As String

        'Connection String to connect with MySQL database.
        connString = "server=localhost;userid=root;password=root;database=sampledb"

        Dim conn As New MySqlConnection(connString)

        conn.Open()

        Dim cmd As New MySqlCommand("create table employee (eid int, ename varchar(16), salary int) ", conn)
        cmd.ExecuteNonQuery()

        Console.WriteLine("Table employee created successfully")
        conn.Close()
    End Sub
End Module
Table employee created successfully
Press any key to continue . . .

Ranjith Kumar

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply