| | |
Connection to MYSQL
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
u will require the latest version of Connector / ODBC (formerly MyODBC), (currently 3.51.06).
download and install it.
then use the following code
Dim rs As ADODB.Recordset
Dim adoconn As ADODB.Connection
Private Sub Command1_Click()
Set adoconn = New ADODB.Connection
adoconn.ConnectionString = "DRIVER={MySQL ODBC 3.15 Driver};SERVER=servername;DATABASE=dbname;UID=userid;PWD=password;OPTION=3;"
adoconn.Open
Set rs = New ADODB.Recordset
rs.ActiveConnection = adoconn
rs.LockType = adLockOptimistic
rs.CursorLocation = adUseClient
rs.CursorType = adOpenDynamic
rs.Open "mysql Query "
While Not rs.EOF
Text2.Text = rs!Name 'Name is the field name
g = MsgBox("press ok", 1, "")
rs.MoveNext
Wend
End Sub
download and install it.
then use the following code
Dim rs As ADODB.Recordset
Dim adoconn As ADODB.Connection
Private Sub Command1_Click()
Set adoconn = New ADODB.Connection
adoconn.ConnectionString = "DRIVER={MySQL ODBC 3.15 Driver};SERVER=servername;DATABASE=dbname;UID=userid;PWD=password;OPTION=3;"
adoconn.Open
Set rs = New ADODB.Recordset
rs.ActiveConnection = adoconn
rs.LockType = adLockOptimistic
rs.CursorLocation = adUseClient
rs.CursorType = adOpenDynamic
rs.Open "mysql Query "
While Not rs.EOF
Text2.Text = rs!Name 'Name is the field name
g = MsgBox("press ok", 1, "")
rs.MoveNext
Wend
End Sub
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: AddItem,Recordset and a varialble??
- Next Thread: Use TaxtBox value in Find function in VBA
Views: 723 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp c++ calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver struct subroutine table tags time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





