Data | database
Import and export between 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]-Drug_yk in [ODBC] [Odbc;driver=sql
Server; Uid=sa; pwd=kcsoft58; Server=127.0.0.1;database=kcsoft_his] ";
To export a MSSQL database table and data to Excel, ABC is a table name that does not exist in Excel, Drug_yk is a table in MSSQL, and SA is
User, kcsoft58 is the password, 127.0.0.1 is the service big address, 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 a MSSQL database table to Excel and perform the equivalent of twice times the amount of data, one for import and one for
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-Drug_yk in [ODBC] [Odbc;driver=sql
Server; Uid=sa; pwd=kcsoft58; Server=127.0.0.1;database=kcsoft_his] ";
The database table and data of a MSSQL are exported to VFP, ABC.DBF is the table name that does not exist in VFP, Drug_yk is the table in MSSQL, SA is
User, kcsoft58 is the password, 127.0.0.1 is the service big address, 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-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-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 ') + ') ...<