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] ');