Hey, does anybody know how to read cloumn from MySQL?
I mean, like if I have in my MySQL the schema "Bdatabase" and the table "accounts".
In that table there are username and password. How can I do in my program that it'll read the username and password?

Edited 3 Years Ago by Reverend Jim: corrected minor typo in title

Use this coding hope how to the connection string in myssql

myConnection = New SqlConnection(connectionstring)
        myConnection.Open()
        myCommand = New SqlCommand(" Select Name FROM [Product_Name_List], myConnection)
        Dim dr As SqlDataReader = myCommand.ExecuteReader
        'ComboBox2.Items.Clear()
        While dr.Read()
            Debug.WriteLine(dr(0))
            TextBox8.Text = (dr(0).ToString)
        End While
        dr.Close()
        myConnection.Close()

Can you explain me about this code? I didn't realize how to use it :(

I have put the expalination right below the coding .hope you can understand.where is your working?

myConnection = New SqlConnection(connectionstring)

'*this coding use to coonect to the database
        myConnection.Open()
         '* openig the data base

        myCommand = New SqlCommand(" Select Name FROM [Product_Name_List], myConnection)
         '* access the correct colum inthe relavent table
         '*as in my case I'm acessing the name coloumn in the Product_Name_List table 
        Dim dr As SqlDataReader = myCommand.ExecuteReader
        '* Passing the commander to the reader
        While dr.Read()
         '* start reading the data
            Debug.WriteLine(dr(0))
            TextBox8.Text = (dr(0).ToString)
             '*Passing the data to the coorect textbox
        End While
        dr.Close()
         '* stop reading the data 
        myConnection.Close()
        closing the the coonectction

try this query if you want to retrieve the columns of your table

SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME='TableName'
This article has been dead for over six months. Start a new discussion instead.