原文出處:
[url]
異構資料庫之間的匯入匯出
//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]');
//把乙個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:\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]');
//把乙個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:\mysmallexe\excel2sql";extended properties=dbase 5.0')+')...
[abc]');
//mssql2access
adoconnection2.connectionstring:=
'provider=microsoft.jet.oledb.4.0;data source=g:\mysmallexe\excel2sql\server.mdb;'
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
//excel2access
adoconnection2.connectionstring:=
'provider=microsoft.jet.oledb.4.0;data source=g:\mysmallexe\excel2sql\server.mdb;'
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
//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]');
異構資料庫之間的匯入匯出
異構資料庫之間的匯入匯出 mssql2excel adoconnection1.connectionstring provider microsoft.jet.oledb.4.0 data source g my allexe excel2sql yp.xls extended properties...
異構資料庫之間的匯入匯出
異構資料庫之間的匯入匯出 mssql2excel adoconnection1.connectionstring provider microsoft.jet.oledb.4.0 data source g my allexe excel2sql yp.xls extended properties...
異構資料庫之間的匯入匯出
異構資料庫之間的匯入匯出 mssql2excel adoconnection1.connectionstring provider microsoft.jet.oledb.4.0 data source g mysmallexe excel2sql yp.xls extended propertie...