How to get MySQL host info by using VB.NET ?

I connect to MySQL, using MyODBC, it seem to be good.

How can I get MySQL host info by using VB.NET ?
I want to fill MySQL host info into a combobox in which user can choose their suitable MySQL host for connection (when my form MySQLLogin is loaded).

Addition: and how to get database name ?

Thanks so much
Who is Participating?

Improve company productivity with a Business Account.Sign Up

planoczConnect With a Mentor Commented:
Yes; that is what Iam running. you can use OdbcConnection.
for example of Sybase.....

    Public SyConnect As Odbc.OdbcConnection
Public Sub OpenDBSyBaseConnection()
            SyConnect = New Odbc.OdbcConnection("DSN=MySybaseName;UID=dba;PWD=MyPassword")
        Catch Ex As Exception
            MsgBox("Exception: " & Ex.Message & "  " & Ex.ToString, MsgBoxStyle.Critical)
            Cursor.Current = Cursors.Default
        End Try
    End Sub

' in the above procedure
 Dim Adapter = New SqlDataAdapter(sSql, SyConnect)
Hi tipt,

Iam not sure on getting to the host info, but here is some code that you might be able to use in working with the table names.

Imports System.Data.SqlClient

 '**** Server Connection Vars *********
    Public sDBServer As String
    Public sUSERid As String
    Public sDBName As String
    Public sDBPass As String
    Public Connect As SqlConnection

     '********* database Var's ************
    Public sSql As String
    Public sTableName As String
    Public sTables() As String                'For Table Listing
    Public bFirstTime As Boolean
    Public iCounter As Short

  Public Sub OpenDBSqlConnection()
        If Len(sDBPass) = 0 Then
            sDBPass = ""
        End If
            Connect = New SqlConnection("Initial Catalog=" & sDBName & ";Data Source=" & sDBServer & ";User ID=" & sUSERid & ";password=" & sDBPass & ";")
        Catch Ex As Exception
            MsgBox("Exception: " & Ex.Message & "  " & Ex.ToString, MsgBoxStyle.Critical)
            Cursor.Current = Cursors.Default
        End Try
    End Sub

  Public Sub TableNames()
        Dim i As Integer
        Dim DS As New DataSet
        sSql = ""
        sSql = "SELECT table_name FROM Information_Schema.Tables"
            Dim Adapter = New SqlDataAdapter(sSql, Connect)
            Dim sNames As String

            ReDim sTables(DS.Tables(0).Rows.Count - 1)
        bFirstTime = True
        iCounter = 0

            For i = 0 To DS.Tables(0).Rows.Count - 1
                sNames = (DS.Tables(0).Rows(i)).Item(0)
                Select Case Left(sNames, 3)
                    Case "sys"
                    Case UCase(Left(sNames, 3))
                    Case "tbl"
                        If bFirstTime = True Then
                            iFirstTime = i
                            bFirstTime = False
                        End If
                        sTables(i) = sNames
                        iCounter = i
                End Select
        Catch Exp As Exception
            MsgBox(Exp.Message & " in TableNames Procedure", MsgBoxStyle.Critical, "General Error")
        End Try
    End Sub
tiptAuthor Commented:
is it also suitable for MySQL ?
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

tiptAuthor Commented:
let me check it :)
tiptAuthor Commented:
This way just for connection, i got it, thanks so much.
But I want to getting host info :(
tiptAuthor Commented:
noone help me?
What kind of hosting are you wanting?
Web connection? Database connection?
tiptAuthor Commented:
database connection
I have never needed to use Host info from server.
So what are you trying to do with this info?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.