Getting DataTypeName of each column of table

eawedat

Member
Joined
Nov 20, 2011
Messages
8
Programming Experience
1-3
Hi there ,
I have this code :

VB.NET:
   Dim query As String = "show columns from " & table_name & " from " & db_name


        Dim connection As New MySqlConnection(cons)
        Dim cmd As New MySqlCommand(query, connection)


        connection.Open()


        Dim reader As MySqlDataReader
        reader = cmd.ExecuteReader()
        MessageBox.Show(reader.FieldCount)

For i As Integer = 0 To reader.FieldCount - 1
       MessageBox.Show(reader.GetDataTypeName(5))
Next

I want to show the field's type of each column of the table , the problem is that FieldCount is incorrect , I do have fields more than VB.NET shows me.

any solutions ?

thanks.
 
Back
Top