Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

[Òý]SQLServerºÍAccess¡¢ExcelÊý¾Ý´«Êä¼òµ¥×ܽá

http://www.tongyi.net/article/20031101/200311013786.shtml
ËùνµÄÊý¾Ý´«Ê䣬ÆäʵÊÇÖ¸SQLServer·ÃÎÊAccess¡¢Excel¼äµÄÊý¾Ý¡£
ΪʲôҪ¿¼Âǵ½Õâ¸öÎÊÌâÄØ£¿
ÓÉÓÚÀúÊ·µÄÔ­Òò£¬¿Í»§ÒÔÇ°µÄÊý¾ÝºÜ¶à¶¼ÊÇÔÚ´æÈëÔÚÎı¾Êý¾Ý¿âÖУ¬ÈçAcess¡¢Excel¡¢Foxpro¡£ÏÖÔÚϵͳÉý¼¶¼°Êý¾Ý¿â·þÎñÆ÷ÈçSQLServer¡¢ORACLEºó£¬¾­³£ÐèÒª·ÃÎÊÎı¾Êý¾Ý¿âÖеÄÊý¾Ý£¬ËùÒԾͻá²úÉúÕâÑùµÄÐèÇó¡£Ç°¶Îʱ¼ä³ö²îµÄÏîÄ¿£¬¾ÍÊÇÃæÁÙÕâÑùµÄÒ»¸öÎÊÌ⣺SQLServerºÍVFPÖ®¼äµÄÊý¾Ý½»»»¡£
ÒªÍê³É±êÌâµÄÐèÒª£¬ÔÚSQLServerÖÐÊÇÒ»¼þ·Ç³£¼òµ¥µÄÊÂÇé¡£
ͨ³£µÄ¿ÉÒÔÓÐ3ÖÖ·½Ê½£º1¡¢DTS¹¤¾ß 2¡¢BCP 3¡¢·Ö²¼Ê½²éѯ
DTS¾Í²»ÐèҪ˵ÁË£¬ÒòΪÄÇÊÇͼÐλ¯²Ù×÷½çÃ棬ºÜÈÝÒ×ÉÏÊÖ¡£
ÕâÀïÖ÷Òª½²ÏºóÃæÁ½ÃÇ£¬·Ö±ðÒԲ顢Ôö¡¢É¾¡¢¸Ä×÷Ϊ¼òµ¥µÄÀý×Ó£º
ÏÂÃæ·Ï»°¾Í²»ËµÁË£¬Ö±½ÓÒÔT-SQLµÄÐÎʽ±íÏÖ³öÀ´¡£
Ò»¡¢SQLServerºÍAccess
1¡¢²éѯAccessÖÐÊý¾ÝµÄ·½·¨£º
select * from OpenRowSet('microsoft.jet.oledb.4.0',';database=c:\db2.mdb','select * from serv_user')
»ò
select * from OpenDataSource('Microsoft.Jet.OLEDB.4.0','Data Source="c:\DB2.mdb";User ID=Admin;Password=')...serv_user
2¡¢´ÓSQLServerÏòAccessдÊý¾Ý£º
insert into OpenRowSet('microsoft.jet.oledb.4.0',';database=c:\db2.mdb','select * from Accee±í')
select * from SQLServer±í
»òÓÃBCP
master..xp_cmdshell'bcp "serv-htjs.dbo.serv_user" out  "c:\db3.mdb" -c -q -S"." -U"sa" -P"sa"'
ÉÏÃæµÄÇø±ðÖ÷ÒªÊÇ£ºOpenRowSetÐèÒªmdbºÍ±í´æÔÚ£¬BCP»áÔÚ²»´æÔÚµÄʱºòÉú³É¸Ãmdb
3¡¢´ÓAccessÏòSQLServerдÊý¾Ý£ºÓÐÁËÉÏÃæµÄ»ù´¡£¬Õâ¸ö¾ÍºÜ¼òµ¥ÁË
insert into SQLServer±í select * from
OpenRowSet('microsoft.jet.oledb.4.0',';database=c:\db2.mdb','select * from Accee±í')
»òÓÃBCP
master..xp_cmdshell'bcp "serv-htjs.dbo.serv_user" in  "c:\db3.mdb" -c -q -S"." -U"sa" -P"sa"'
4¡¢É¾³ýAccessÊý¾Ý£º
delete from OpenRowSet('microsoft.jet.oledb.4.0',';database=c:\db2.mdb','select * from serv_user')
where lock=0
5¡¢ÐÞ¸ÄAccessÊý¾Ý£º
update OpenRowSet('microsoft.jet.oledb.4.0',';database=c:\db2.mdb','select * from serv_user')
set lock=1
SQLServerºÍAccess´óÖ¾ÍÕâô¶à¡£
¶þ¡¢SQLServerºÍExcel
1¡¢ÏòExcel²éѯ
select * from OpenRowSet('microsoft.jet.oledb.4.0','Excel 8.0;HD


Ïà¹ØÎĵµ£º

SQLServerµÄËø»úÖÆ

×î½üÒòΪҪдһ¸öÊý¾Ý²¢·¢·ÃÎʵĿØÖƳÌÐò£¬ÉÏÍø²éÁËһЩ×ÊÁÏ£¬ÏÖÔÚ¹éÄÉÈçÏ£º ËøµÄ¸ÅÊö Ò». ΪʲôҪÒýÈëËø
¶à¸öÓû§Í¬Ê±¶ÔÊý¾Ý¿âµÄ²¢·¢²Ù×÷ʱ»á´øÀ´ÒÔÏÂÊý¾Ý²»Ò»ÖµÄÎÊÌ⣺
¶ªÊ§¸üÐÂ
A£¬BÁ½¸öÓû§¶ÁͬһÊý¾Ý²¢½øÐÐÐ޸ģ¬ÆäÖÐÒ»¸öÓû§µÄÐ޸Ľá¹ûÆÆ»µÁËÁíÒ»¸öÐ޸ĵĽá ......

Microsoft SqlServer 2005 ͨÓ÷ÖÒ³ ´æ´¢¹ý³Ì

±¾À´ÎÒÊDz»ÔÞ³ÉʹÓÃͨÓô洢¹ý³ÌµÄ£¬Ö÷ÒªÊÇÒòΪ¸ù¾Ý±í½á¹¹À´¶¨ÖÆ·ÖÒ³²éѯ²»Óö¯Ì¬µÄÆ´SQL£¬ÕâÑù²ÅÊÇÕæÕýµÄ¸ßЧ£¬¶øÇÒֻҪд¹ýÒ»¸ö£¬ÄÇôÔÙÓÐÐÂÐèÇóµÄʱºò£¬Ð¡·¶Î§¸Ä¶¯¼¸´¦¾ÍokÁË¡£
µ«×ÜÊÇÓÐÈËÏòÎÒÌÖÒª»òÕßÌÖÂÛͨÓô洢¹ý³Ì£¬Ã»°ì·¨£¬±»±ÆÎÞÄΣ¬Á¼ÐÄÉ¥ÓëÀ§¾³¡£
ľÓÐÕÒµ½T-SQL´úÂë±à¼­Æ÷
-- ============================= ......

һЩSqlServerÓï¾ä

Ò»¡¢»ù´¡
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿â
CREATE DATABASE database-name
2¡¢ËµÃ÷£ºÉ¾³ýÊý¾Ý¿â
drop database dbname
3¡¢ËµÃ÷£º±¸·Ýsql server
--- ´´½¨ ±¸·ÝÊý¾ÝµÄ device
USE master
EXEC sp_addumpdevice 'disk', 'testBack', 'c:\mssql7backup\MyNwind_1.dat'
--- ¿ªÊ¼ ±¸·Ý
BACKUP DATABASE pubs TO testBack
4¡¢Ëµ ......

ÓÃC#¿ª·¢ÅúÁ¿ACCESSÊý¾Ý¿âѹËõ³ÌÐò

ÏÂÃæ¸ø³öÁËʹÓÃC# ¿ª·¢µÄÒ»¸öѹËõACCESSÊý¾Ý¿âµÄ³ÌÐò
ÏñFolderBrowserDialog£¨ÓÃÓÚä¯ÀÀÑ¡ÔñÎļþ¼ÐµÄ¶Ô»°¿ò£©¡¢MessageBox£¨ÏûÏ¢´¦Àí¶Ô»°¿ò£©¡¢DirectoryInfo£¨Ä¿Â¼ÐÅÏ¢£¬¿ÉÓÃÓÚ´´½¨¡¢¼ì²âÊÇ·ñ´æÔڵȶÔĿ¼µÄ²Ù×÷£©¡¢FileInfo£¨ÎļþÐÅÏ¢£¬¿ÉÓÃÓÚÎļþµÄ¼ì²â¡¢ÎļþÐÅÏ¢µÄ»ñÈ¡¡¢¸´ÖƵȲÙ×÷£©¡¢DataGridView£¨Êý¾Ý±í¸ñ¿Ø¼þ£¬ÓÃÓ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ