How to import Access and Excel into the three _php tutorials in MySQL

Source: Internet
Author: User
Two. VB Program of Guide Library
This project to use some object library, in terms of database access, the decision to use ADO (ActiveX Data Objects), for the person who used the ASP, the name should be very familiar with, in fact, its application in VB is almost the same, because to manipulate Excel, Also refer to an Extended object library. In the Point menu, "Engineering"---"References", select "Microsoft ActiveX Data Objects 2.6 Library" and "Microsoft Excel 9.0 Object Library", in the reference list, The version of the Reference object library may be different, so choose the latest version of the same. To use dialogs and progress bars, also refer to some parts, "engineering"-"parts" in the order list, select "Microsoft Common Dialog Control 6.0 (SP3)" and "Microsoft Windows Common Controls" 6.0 (SP3) ".
 
An interface is shown

The controls represented by the figures in the figure are:
1-3:3 are TextBox controls, with the name mdbfilename,mdbpassword,xlsfilename,mdbfilename used to indicate the path and file name of the imported Access file. Mdbpassword The password used to enter the Access file, Xlsfilename is used to indicate the path and file name of the imported Excel file;
4: Name is Select_mdbfile,commandbutton control, used to select the Access file to import;
5: Name is Importmdb,commandbutton control, after selecting a good file, use this button to import MDB file
6: Name is Commondialog1,commondialog control
7: The name is Select_xlsfile,commandbutton control, used to select the Excel file to import;
8: Name is Importxls,commandbutton control, after selecting a good file, use this button to import the XLS file;
9: Name is Commondialog2,commondialog control
10: The name is PrgBar1, progress bar (ProgressBar), when you want to import many records, use the progress bar to indicate the current import progress
11: The name is StatusBar1, the status bar (StatusBar), indicating the status of the import, including "Importing," "Import done," and so on.
 
To set the style to "1-sbrsimple"

Make the following statement on the head of the program
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 the form to enter the following code when loading the form
Private Sub Form_Load ()
' Set the progress bar to not be visible
Prgbar1.visible = False
' Connect MySQL database, pwd is the database password, UID is username, DSN is the name of the data source
cnmysql.connectionstring = "uid=root;pwd=;d sn=build"
Cnmysql.open
End Sub

http://www.bkjia.com/PHPjc/631143.html www.bkjia.com true http://www.bkjia.com/PHPjc/631143.html techarticle two. Guide to the Library of VB program this project to use some object library, in the database access, the decision to use ADO (ActiveX Data Objects), for those who used ASP, the name should be very ...

  • Related Article

    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.