異構資料庫之間的匯入匯出

2021-04-01 22:10:17 字數 3652 閱讀 2564

異構資料庫之間的匯入匯出

//mssql2excel

adoconnection1.connectionstring:=

'provider=microsoft.jet.oledb.4.0;data source=g:/my**allexe/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]');

//把乙個mssql的資料庫表及資料匯出到excel中,abc為excel中不存在的表名,drug_yk為mssql裡的表, sa為

使用者,  kcsoft58為密碼 , 127.0.0.1為服務大位址 ,kcsoft_his是資料庫名稱

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

//把乙個mssql的資料庫表的記錄增加到到excel中,執行以後相當於兩倍量的資料,一次是匯入,一次是

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:/my**allexe/excel2sql/yp.xls";extended properties=excel 8.0')

+')...[abc]');

//mssql2vfp

adoconnection2.connectionstring:=

'provider=microsoft.jet.oledb.4.0;data source=g:/my**allexe/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]');

//把乙個mssql的資料庫表及資料匯出到vfp中,abc.dbf 為vfp中不存在的表名,drug_yk為mssql裡的表, sa為

使用者,  kcsoft58為密碼 , 127.0.0.1為服務大位址 ,kcsoft_his是資料庫名稱

//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:/my**allexe/excel2sql";extended properties=dbase 5.0')+')...

[abc]');

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:/my**allexe/excel2sql/server.mdb";jet oledb:database

8.0;database=g:/my**allexe/excel2sql/yp.xls].[abc$]');

//access2excel

adoconnection2.connectionstring:=

'provider=microsoft.jet.oledb.4.0;data source=g:/my**allexe/excel2sql/yp.xls;'

+'extended properties=excel 8.0';

adoconnection2.execute('select * into abc  from

//mssql2txt

adoconnection2.connectionstring:=

'provider=microsoft.jet.oledb.4.0;data source=g:/my**allexe/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:/my**allexe/excel2sql";extended properties=text')+')...

[abc#txt]');

異構資料庫之間的匯入匯出

異構資料庫之間的匯入匯出 mssql2excel adoconnection1.connectionstring provider microsoft.jet.oledb.4.0 data source g my allexe excel2sql yp.xls extended properties...

異構資料庫之間的匯入匯出

原文出處 url 異構資料庫之間的匯入匯出 mssql2excel adoconnection1.connectionstring provider microsoft.jet.oledb.4.0 data source g mysmallexe excel2sql yp.xls extended ...

異構資料庫之間的匯入匯出

異構資料庫之間的匯入匯出 mssql2excel adoconnection1.connectionstring provider microsoft.jet.oledb.4.0 data source g mysmallexe excel2sql yp.xls extended propertie...