How to import Access and Excel to Mysql 3 _ PHP Tutorial

Source: Internet
Author: User
Tags import database
How to import Access and Excel to Mysql 3. II. The VB program of the import database uses some object libraries. in terms of database access, we decided to use ADO (ActiveXDataObjects). For those who have used ASP, this name should be very different. VB program of the import database
This project requires some object libraries. in terms of database access, we decided to use ADO (ActiveX Data Objects). For those who have used ASP, this name should be very familiar. In fact, its application in VB is almost the same. to operate Excel, an extended object library should also be referenced. Click "project"> "reference" in the menu and select "Microsoft ActiveX Data Objects 2.6 Library" and "Microsoft Excel 9.0 Object Library". in the reference list, the version of the object library that can be referenced may be different. you can select a similar latest version. To use the Dialog box and progress bar, you also need to reference some parts. in the menu, select "project"> "parts" and select "Microsoft Common Dialog Control 6.0 (SP3) "and" Microsoft Windows Common Controls 6.0 (SP3 )".
 
Interface 1

The following controls are displayed:
1-are TextBox controls named mdbfilename, mdbpassword, xlsfilename, and mdbfilename to indicate the path and file name of the imported Access file, and mdbpassword to enter the password of the Access file, xlsfilename indicates the path and file name of the Excel file to be imported;
4: The name is select_mdbfile and the CommandButton control is used to select the Access file to be imported;
5: The name is importMDB, CommandButton control. after selecting a file, use this button to import the MDB file.
6: CommonDialog1, CommonDialog control
7: The name is select_xlsfile, CommandButton control, used to select the Excel file to be imported;
8: The name is importXLS, CommandButton control. after selecting a file, use this button to import the XLS file;
9: CommonDialog2, CommonDialog control
10: The name is prgBar1, and the progress bar (ProgressBar). when you want to import many records, you can use the progress bar to indicate the current import progress.
11: The name is StatusBar1, and the status bar (StatusBar) indicates the import progress, including "importing" and "importing completed.
 
Set Style to "1-sbrSimple"

Make the following statement in the program header
Option Explicit
Dim Cn As New ADODB. Connection
Dim Cnmysql As New ADODB. Connection
Dim Rs As New ADODB. Recordset
Dim Rsmysql As New ADODB. Recordset

Function replace_str (srcstr As String)
Srcstr = Replace (srcstr ,"","")
Replace_str = Replace (srcstr ,"'","'")
End Function

Double-click form and enter the following code when loading form:
Private Sub Form_Load ()
'Set the progress bar to invisible
PrgBar1.Visible = False
'Connect to the mysql database. pwd is the database password, uid is the user name, and dsn is the data source name.
Cnmysql. ConnectionString = "uid = root; pwd =; dsn = build"
Cnmysql. Open
End Sub

Bytes. The VB program of the import database uses some object libraries. in terms of database access, it is decided to use ADO (ActiveX Data Objects). For those who have used ASP, this name should be very...

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.