View Single Post
  #2 (permalink)  
Old 07-26-06, 12:00 PM
digioz's Avatar
digioz digioz is offline
Community VIP
 
Join Date: Oct 2003
Location: Chicago, IL
Posts: 2,171
Thanks: 3
Thanked 9 Times in 9 Posts
Download MySQL ODBC Driver:

http://dev.mysql.com/downloads/connector/odbc/3.51.html

Here is a sample code:

Code:
Private Sub cmdConnect_Click()
Dim cn As New rdoConnection
Dim qry As New rdoQuery
Dim rs As rdoResultset
 
cn.CursorDriver = rdUseOdbc
cn.Connect = "uid=UserName;pwd=Password;server=localhost;driver={MySQL ODBC 3.51 Driver};database=DatabaseName;dsn=;"

cn.EstablishConnection
 
With qry
	.Name = "queryName"
	.SQL = "select * from tblName"
	.RowsetSize = 1
	Set .ActiveConnection = cn
	Set rs = .OpenResultset(rdOpenKeyset, rdConcurRowVer)
End With
	
 loop through the record set processing the
 records and fields.
Do Until rs.EOF
	With rs
	  ' your code using rs!fieldname
	  rs.MoveNext
	End With
Loop
rs.Close
cn.Close
End Sub
__________________
Reply With Quote