zoukankan      html  css  js  c++  java
  • 以數據源方式讀取文本文件連接串及注事事項

    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";
    The delimiter can be specified in the registry at the following location:
    HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Jet \ 4.0 \ Engines \ Text
    "Format" = "TabDelimited"
    or
    "Format" = "Delimited(;)"
    注意:如果文本文件是Unicode編碼,則需指定CharacterSet為UniCode
     
    Fixed length columns
    Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\txtFilesFolder\;Extended Properties="text;HDR=Yes;FMT=Fixed";
    "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)   "
    or maybe use a single quota '.
    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.
    [customers.txt]
    Format=TabDelimited
    ColNameHeader=True
    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
  • 相关阅读:
    C语言程序设计第5堂作业
    C语言程序设计第4堂作业
    gets和fgets函数的区别
    编写一个程序实现strcpy函数的功能
    编写一个程序实现strcmp函数的功能
    编写一个程序实现strcat函数的功能
    11-1. 通讯录的录入与显示(10)
    11-0. 平面向量加法(10)
    10-4. 字符串循环左移(20)
    10-3. 字符串逆序(15)
  • 原文地址:https://www.cnblogs.com/dimg/p/673860.html
Copyright © 2011-2022 走看看