I try to update my knowledge from MS Access Database connection into MySQL Database connection. I've learned much in ms access Database and this my first time to learn MySQL Database. How can I convert my code to MySQL ODBC connection?
I've installed MySQL ODBC 3.5.1 and MySQL ODBC 5.1 driver for sure purposes.
Module form code in ms access : (ActiveX Data 2.8 library)
Public con As New ADODB.connection Public rs As New ADODB.Recordset Public Sub connection() Path = App.Path & "\dbuser.mdb" con.Open "provider = microsoft.jet.oledb.4.0;data source = " & Path con.CursorLocation = adUseClient End Sub
I would grab this opportunity to add more code using ms access database:
ADD button code :
connection rs.Open "select * from tbluser where userid = '" & txtuserid.Text & "'", con, 3, 3 If rs.RecordCount = 0 Then rs.AddNew (if you want to edit just change the rs.AddNew to rs.Update) rs("userame") = txtuser.text rs("Password") = txtpass.text rs("type") = cbotype.text rs("T_IN") = lbltimein.Caption rs("D_IN") = lblsdatein rs.Update end if rs.Close: Set rs = Nothing con.Close: Set con = Nothing
I like this code because its easy to understand for me. It would help for others looking for connection to ms access database.
I've try to setup Adodc component and it connect to MySQL DSN perfectly. I'm still in that stage of learning right now. I've try to convert that code but it didn't work.
Need help here please...