Of course the machine is equipped with MySQL database
Then download and install the MYSQL,ODBC driver
Need to join ADO ' menu "project", "reference" to find Microsoft ActiveX Data Object .... or simply find the ADO control and throw it on the form and delete it.
The code to connect to the database in VB:
Dim cn as New ADODB. ConnectionDim rs as New ADODB. Recordset ' definition database connection string variable Dim strcn As String ' Define database connection parameter Dim db_host As StringDim Db_user as StringDim Db_pass as StringDim Db_data As String ' Define SQL statement variable Dim sql As String ' Initialize database connection variable db_host = ' localhost ' db_user = ' root ' usernamedb_pass = ' root ' ' User Passworddb_data = ' Radio ' database name ' MySQL ODBC connection number ' +------------+---------------------+---------------------------- ------+ ' | Name of the Participant | Default value | Description | ' +------------+------------------------------------------------------–+ ' | user | ODBC (on Windows) | MySQL Username | ' | Server | localhost | MySQL server Address | ' | Database | | Default Connection Database | ' | Option | 0 | Parameters to specify how the connection works | ' | Port | 3306 | Connection Port | ' | stmt | | A statement that can execute after connecting to the database | password | | MySQL User Password | ' | sockets | | (slightly) | ' +------------+---------------------+----------------------------------+ ' specific view official notes ' http://dev.mysql.com/doc/ REFMAN/5.0/EN/MYODBC-CONFIGURATION-CONNECTION-PARAMETERS.HTMLSTRCN = "Driver={mysql ODBC 3.51 DRIVER};" & _ "S Erver= "& Db_host &"; "& _" database= "& Db_data &"; "& _" uid= "& Db_user & Amp "; Pwd= "& Db_pass &"; "& _" Option=3;stmt=set NAMES GB2312 "' Stmt=set NAMES GB2312 ' This is the Set database encoding method ' Chinese Operation Department The system needs to be set to GB2312 ' So Chinese will not have a problem ' version number requires MySQL 4.1+ ' to connect to the database CN. Open STRCN ' Sets this property so that the RecordCount and AbsolutePage properties are available in the CN. CursorLocation = adUseClient ' interview table Table1sql = "Select Nicheng,xinqing from nichengandxinqing where uid= ' 1 '" Rs. Open SQL, Cndim Nicheng as StringDim xinqing as String ' Load user Nickname Nicheng = Rs. Fields (0) Label1.Caption = Nicheng ' load user mood phrase xinqing = Rs. Fields (1) label2.caption = Xinqing ' mouse placed in mood phrase hint phrase specific information Label2.tooltiptext = xinqing ' Load network picture IMAge1. Picture = LoadPicture ("http://hi.csdn.net/attachment/201201/5/8747069_1325751084ZiD4.jpg")