Now, I have successfully switched the access data to the mysql format, and I will dedicate it to those who need it.
Source: Internet
Author: User
Step 1: Prepare the database. Install the data source (I have been charged for several days). First, click
Odbc data source (32-bit)
, Click to enter and select
User DSN (which is the default one)
, Select
Ms access 97 DATABASE option, click the configuration button on the right.
The window name is [Odbc microsoft installation].
Select the database you want to call in the middle. (Select button)
Click "advanced settings" on the right to bring up a [Advanced Settings options] in which to set the user password and user name (each name is recorded). Click "option type" at the bottom of the column.
Defaultdir: enter your database (access database) in the bottom value ). Then return to the initial position (user DSN) one by one. At this time, [add] the data source you just added, select *. mdb (access), and click finish. Go to another page and start with the data source: data source name of your database: (for example, if I used taici. mdb before, enter taici here ). Then you must select the database you are looking. Okay, now the database can come to an end.
Step 2, that is the problem of program switching.
<?
$ Cnx = odbc_connect ('taici', 'admin', 'wsd ');
Remember? When you enter the user and password, you can remember the Admin and WSD. Do you know how to do this ?!
$ Cur = odbc_exec ($ cnx, 'select * from word ');
The word is one of the tables taici.
$ Num_row = 0;
$ Conn = mysql_pconnect ("localhost", "wsd", "wsd"); // Connect to mysql
@ Mysql_select_db ('MS', $ conn) or
Die ("unable to connect to the database, please contact the administrator! "); // Open mysql's mydb database
While (odbc_fetch_row ($ cur) // extracts data from the user table in the mydb database of SQL server one by one. If you select the data, you can add conditions in the preceding select statement.
{
$ Num_row ++;
$ Field1 = odbc_result ($ cur, 1); // here the parameter I (, 3 ..) it refers to the I-th field in the record set. You can select it selectively. fieldi gets the value of the corresponding field, and then you can perform operations on fieldi.
$ Field2 = odbc_result ($ cur, 2 );
$ Field3 = odbc_result ($ cur, 3 );
$ Field4 = odbc_result ($ cur, 4 );
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service