I use visual basic 6. I have a button that, when clicked, should display all the records in the table. I am using the following code to connect to a MySQL database. I used Microsoft Remote Data Services as my link
code:
Private Sub cmdConnectMySQL_Click() Dim cnMySql As New rdoConnection Dim rdoQry As New rdoQuery Dim rdoRS As rdoResultset cnMySql.CursorDriver = rdUseOdbc cnMySql.Connect = "uid=root;pwd=; server=localhost; driver={MySQL ODBC 3.51 Driver}; database=demo;dsn=;" cnMySql.EstablishConnection With rdoQry .Name = "selectUsers" .SQL = "select * from user" .RowsetSize = 1 Set .ActiveConnection = cnMySql Set rdoRS = .OpenResultset(rdOpenKeyset, rdConcurRowVer) End With Do Until rdoRS.EOF With rdoRS rdoRS.MoveNext End With Loop rdoRS.Close cnMySql.Close End Sub
I can not connect to the database. How to connect?
source share