常用ODBC链接命令
数据库类
09-12
阅读:518
评论:2
连接文件() → "Driver={Microsoft Text Driver (*.txt; *.csv)};Data Source=%s;Extensions=asc,csv,tab,txt;" 连接Excel() → "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Excel 8.0;Data Source=%s" 连接Excel2007() → "Provider=Microsoft.ace.OLEDB.12.0;Extended Properties=Excel 12.0;Data Source=%s" 连接Excel各版本 → "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=path to xls/xlsx/xlsm/xlsb file" 例: "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=c:\123.xlsx" 连接SQLite3()→ "Provider=MSDASQL.1;Extended Properties=Driver={SQLite3 ODBC Driver};Password='%PW';Database=%DB;" 连接MySQL()→ "Driver={MySQL ODBC %驱动 Driver};Server=%服务器名;Port=%端口;DataBase=%数据库名;UID=%用户名;Password=%密码;Stmt=Set Names '%编码'" 连接SQLServer()→ "Provider=SQLOLEDB.1;Password=%PWD;Persist Security Info=True;Initial Catalog=%ICG;User ID=%UID;Data Source=%DSE" 连接Access()→ "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Database Password=%DP;Data Source=%DS" 连接Access2007()→ "Provider=Microsoft.ace.OLEDB.12.0;Data Source=%DS;Jet OLEDB:Database Password=%DP;" CDataODBC驱动 http://www.cdata.com/drivers/excel/odbc/ 连接Excel(使用CDataODBC驱动) → "DRIVER={CData ODBC Driver for Excel};Excel File=C:\MyExcelWorkbooks\SampleWorkbook.xlsx"
ODBC链接所需驱动程序下载地址: http://newren.cc/elp.html#odbc (页面查找 Office2007ODBC驱动)
版权声明
本文由牛人工作室发布。未经许可,不得转载。