VB.net Program to Get the Mysql Version Using the ‘Select’ Statement

You are currently viewing VB.net Program to Get the Mysql Version Using the ‘Select’ Statement

VB.Net program to get the Mysql version using the ‘Select’ statement

'VB.NET program to get MySql version 
using Select statement.

Imports MySql.Data.MySqlClient

Module Module1
    Sub Main()
        Dim connString As String
        Dim MySqlVersion 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("Select VERSION()", conn)

        MySqlVersion = cmd.ExecuteScalar().ToString()

        Console.WriteLine("MySql Version is: " & MySqlVersion)
        conn.Close()
    End Sub
End Module
MySql Version is: 8.0.22
Press any key to continue . . .

Ranjith

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

Leave a Reply