Visual VB6 less information, it took a long time to write a query statement
First download the driver, I am win7 x64 do not know just started to download a 5.1 x64 driver why not connected, the total hint can not find the driver, download 5.3 32 bit after normal
http://dev.mysql.com/downloads/connector/odbc/
Dimcn as NewADODB. ConnectionDimRs as NewADODB. Recordset'defining database connection string variablesDimStrcn as String'defining database connection parameter variablesDimDb_host as StringDimDb_user as StringDimDb_pass as StringDimDb_data as StringDimCmd as NewAdodb.command'defining SQL Statement variablesDimSql as String'Initializing database connection variablesDb_host ="127.0.0.1"Db_user="Root"Db_pass=""Db_data="Family"STRCN="driver={mysql ODBC 5.3 Unicode DRIVER};"& _ "server="& Db_host &";"& _ "database="& Db_data &";"& _ "uid="& Db_user &"; Pwd="& Db_pass &";"& _ "option=3;stmt=set NAMES UTF8" 'connecting to a database'CN. Open STRCN'set this property so that the RecordCount and AbsolutePage properties are available'CN. CursorLocation = adUseClient'Rs. Open "Tb_sys_emp", CN, adOpenKeyset, adLockOptimistic'Rs. MoveFirst'Do While Rs. EOF = False'Debug.Print Rs. Fields ("Emp_name")'Rs. MoveNext'Loop'Rs. CloseCN. Open STRCNSetCmd. ActiveConnection =Cncmd.commandtext="Select Emp_name from Tb_sys_emp"Cmd.commandtype=Adcmdtextcmd.commandtimeout= theSetrs =cmd. Executers.movefirst Do whileRs. EOF =FalseDebug.Print Rs. Fields ("Emp_name") Rs. MoveNextLoopRs. Closedebug.print list. Count
VB6 connecting MySQL Database