连接 Textfile http://www.javawolf.com/dbcon/text.htm

ODBC
Standard
Driver= {Microsoft Text Driver (*.txt; *.csv)}; Dbq= c:/txtFilesFolder/; Extensions= asc,csv,tab,txt;

OLE DB
Delimited columns
Provider= Microsoft.Jet.OLEDB.4.0; Data Source= c:/txtFilesFolder/; Extended Properties= "text;HDR=Yes;FMT=Delimited";
( HDR 表示有无标题行,详细的配置信息在Schema.ini文件中设置
注意引号在不同语言中需要转义,如xml中为"
原文解释:
"HDR=Yes;" indicates that the first row contains columnnames, not data. "HDR=No;" indicates the opposite.
To specify each columns length use the Schema.ini file. See description below.
Important note!
The quota " in the string needs to be escaped using your language specific escape syntax.
c#, c++ /"
VB6, VBScript ""
xml (web.config etc) & quot;
or maybe use a single quota '.

Schema.ini
Schema.ini
[customers.txt]
Format=TabDelimited
ColNameHeader=Truev MaxScanRows=0
CharacterSet=ANSI

[orders.txt]
Format=Delimited(;)
ColNameHeader=True
MaxScanRows=0
CharacterSet=ANSI

[invoices.txt]
Format=FixedLength
ColNameHeader=False
Col1=FieldName1 Integer Width 15
Col2=FieldName2 Date Width 15
Col3=FieldName3 Char Width 40
Col4=FieldName4 Float Width 20
CharacterSet=ANSI
( schema.ini文件一般和text文件放在同一级目录下,并且文件名必须为schema.ini
原文解释:
The schema information file tells the driver about the format of the text files. The file is always located in the same folder as the text files and must be named schema.ini.
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值