Import and export between heterogeneous databases _ MySQL

Source: Internet
Author: User
Tags dbase
Import and export between heterogeneous databases MSSQL2EXCELADOConnection1. ConnectionString: ProviderMicrosoft. Jet. OLEDB.4.0; performanceg: large; ADOConnection1.Execute (select * into [Abc] fromdrug_ykIN [import and export between ODB heterogeneous databases

// MSSQL2EXCEL
ADOConnection1.ConnectionString: =
'Provider = Microsoft. Jet. OLEDB.4.0; Data Source = G: \ mysmallexe \ excel2sql \ yp.xls ;'
'Extended Properties = excel 8.0 ';
ADOConnection1.Execute ('select * into [Abc] from drug_yk IN [ODBC] [ODBC; Driver = SQL

Server; UID = sa; PWD = kcsoft58; Server = 127.0.0.1; DataBase = kcsoft_his] ');
// Export a database table and data of MSSQL to excel. abc is the name of a table that does not exist in excel, drug_yk is the table in MSSQL, and sa is

User: kcsoft58 is the password, 127.0.0.1 is the service address, and kcsoft_his is the database name.
ADOConnection1.Execute ('Insert into [abc] select * from drug_yk in [ODBC] [ODBC; Driver = SQL

Server; UID = sa; PWD = kcsoft58; Server = 127.0.0.1; DataBase = kcsoft_his] ');
// Add the records of an MSSQL database table to an excel file. after execution, the data volume is equivalent to twice, which is imported at one time and

Insert


// EXCEL2MSSQL
ADOConnection1.ConnectionString: = 'provider = SQLOLEDB.1; Password = KCSOFT58; Persist Security

Info = True; User ID = SA; Initial Catalog = KCSOFT_HIS; Data Source = Chen ';
ADOConnection1.Execute ('select * into [abc] FROM OpenDataSource ('
QuotedStr ('Microsoft. Jet. OLEDB.4.0 ')','
QuotedStr ('data Source = "G: \ mysmallexe \ excel2sql \ yp.xls"; Extended Properties = excel 8.0 ')

')... [Abc]');


// MSSQL2VFP
ADOConnection2.ConnectionString: =
'Provider = Microsoft. Jet. OLEDB.4.0; Data Source = G: \ mysmallexe \ excel2sql ;'
'Extended Properties = dBase 5.0 ';
ADOConnection2.Execute ('select * into Abc. dbf from drug_yk IN [ODBC] [ODBC; Driver = SQL

Server; UID = sa; PWD = kcsoft58; Server = 127.0.0.1; DataBase = kcsoft_his] ');
// Export an MSSQL database table and data to VFP. Abc. dbf is the name of a table that does not exist in VFP, drug_yk is the table in MSSQL, and sa is

User: kcsoft58 is the password, 127.0.0.1 is the service address, and kcsoft_his is the database name.


// VFP2MSSQL
ADOConnection2.ConnectionString: = 'provider = SQLOLEDB.1; Password = KCSOFT58; Persist Security

Info = True; User ID = SA; Initial Catalog = KCSOFT_HIS; Data Source = Chen ';
ADOConnection2.Execute ('select * into [abc] FROM OpenDataSource ('
QuotedStr ('Microsoft. Jet. OLEDB.4.0 ')','
QuotedStr ('data Source = "G: \ mysmallexe \ excel2sql"; Extended Properties = dBase 5.0 ')')...

[Abc] ');


// MSSQL2access
ADOConnection2.ConnectionString: =
'Provider = Microsoft. Jet. OLEDB.4.0; Data Source = G: \ mysmallexe \ excel2sql \ Server. MDB ;'
'Persist Security Info = False; Jet OLEDB: Database Password = HappyNewYear ';
ADOConnection2.Execute ('select * into Abc from drug_yk IN [ODBC] [ODBC; Driver = SQL

Server; UID = sa; PWD = kcsoft58; Server = 127.0.0.1; DataBase = kcsoft_his] ');


// Access2MSSQL
ADOConnection2.ConnectionString: = 'provider = SQLOLEDB.1; Password = KCSOFT58; Persist Security

Info = True; User ID = SA; Initial Catalog = KCSOFT_HIS; Data Source = Chen ';
ADOConnection2.Execute ('select * into [abc] FROM OpenDataSource ('
QuotedStr ('Microsoft. Jet. OLEDB.4.0 ')','
QuotedStr ('data Source = "G: \ mysmallexe \ excel2sql \ Server. MDB"; Jet OLEDB: Database

Password = happynewyear ')... [Abc]');


// Excel2access
ADOConnection2.ConnectionString: =
'Provider = Microsoft. Jet. OLEDB.4.0; Data Source = G: \ mysmallexe \ excel2sql \ Server. MDB ;'
'Persist Security Info = False; Jet OLEDB: Database Password = HappyNewYear ';
ADOConnection2.Execute ('select * into [abc] FROM [excel

8.0; database = G: \ mysmallexe \ excel2sql \ yp.xls]. [abc $] ');

// Access2excel
ADOConnection2.ConnectionString: =
'Provider = Microsoft. Jet. OLEDB.4.0; Data Source = G: \ mysmallexe \ excel2sql \ yp.xls ;'
'Extended Properties = excel 8.0 ';
ADOConnection2.Execute ('select * into abc from

[G: \ mysmallexe \ excel2sql \ Server. MDB; pwd = happynewyear]. ABC ');


// MSSQL2txt
ADOConnection2.ConnectionString: =
'Provider = Microsoft. Jet. OLEDB.4.0; Data Source = G: \ mysmallexe \ excel2sql ;'
'Extended Properties = text ';
ADOConnection2.Execute ('select * into Abc # txt from drug_yk IN [ODBC] [ODBC; Driver = SQL

Server; UID = sa; PWD = kcsoft58; Server = 127.0.0.1; DataBase = kcsoft_his] ');


// Txt2MSSQL
ADOConnection2.ConnectionString: = 'provider = SQLOLEDB.1; Password = KCSOFT58; Persist Security

Info = True; User ID = SA; Initial Catalog = KCSOFT_HIS; Data Source = Chen ';
ADOConnection2.Execute ('select * into [abc] FROM OpenDataSource ('
QuotedStr ('Microsoft. Jet. OLEDB.4.0 ')','
QuotedStr ('data Source = "G: \ mysmallexe \ excel2sql"; Extended Properties = text ')')...

[Abc # txt] ');

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.