zoukankan      html  css  js  c++  java
  • delphi 连接DBF

    delphi 连接DBF

    使用 DBF 文件时,文件夹表示数据库,单个 DBF 文件表示表

    1、BDE,已淘汰

     
     table1.Databasename:=dbdir;//设置库路径
    table1.TableName:=dbname;

    2、ADO

       1)用Microsoft jet4.0驱动字符串,大多数机器都安装了,可用

       2)Microsoft Visual FoxProDriver驱动,需要下载安装

            https://docs.microsoft.com/en-us/sql/odbc/microsoft/visual-foxpro-odbc-driver

           https://support.microsoft.com/en-us/help/277772/visual-foxpro-odbc-driver-not-included-in-mdac-2.6-and-later

         连接字符串格式如下:

           PROVIDER=MSDASQL;DRIVER={Microsoft Visual Foxpro Driver};SourceDB=%S;SourceType=DBF

       3)Visual FoxPro OLE DB provider

            ADOConstr =
                    "Provider=VFPOLEDB.1;Data Source=%s;Mode=Share Deny None;Extended Properties=;Collating Sequence=MACHINE";

          Microsoft OLE DB Provider for Visual FoxPro 9.0 下载地址2017.4.20

          https://www.microsoft.com/en-us/download/details.aspx?id=14839

           VFPOLEDBSetup.msi,安装后DBF问题都可以解决,突破dbase里的单行4000字节的限制。

         setup path

        C:Program Files (x86)Microsoft Visual FoxPro OLE DB Provider

    3、ADS(Advantage Database Server)

        DriverID=ADS Database=c:adsdata TableType=VFP

       http://docs.embarcadero.com/products/rad_studio/firedac/frames.html?frmname=topic&frmfile=Connect_to_Advantage_Database_Server.html

    微软官方不建议用Visual FoxPro ODBC Driver,官方声明如下。代替的是Visual FoxPro OLE DB provider

    https://msdn.microsoft.com/en-us/library/mt490121

    Visual FoxPro ODBC Driver
    The VFPODBC driver is no longer supported. We strongly recommend using the Visual FoxPro OLE DB provider as a replacement. Please refer to the following article for more information and related links to issues when using the VFPODBC driver: http://support.microsoft.com/kb/277772.

    ADO连接DBF的连接字符串

    Provider = Microsoft.Jet.OLEDB.4.0 ;Data Source ={0};Extended Properties=dBASE IV
    Provider=Microsoft.Jet.OLEDB.4.0;Password="";Data Source=%s;Extended Properties=dbase 5.0;Persist Security Info=True

    每行记录中字符的最大数目 65,500
    每行记录中字段的最大数目 255
    每个字段中字符数的最大值 254 

    create table 的时候,80个字段成功,81个字段就报错。有36个字段的类型varchar(200)。是不是太宽了。

    字段将不能置于记录中

    某个字段类型宽度太大的原因?字段没有超过255的varchar(255),这个原因不存在.

    20个varchar(200)可以创建成功,第21个字段即使是1个字节varchar(1)也不成功。

    把第20个改成varchar(201),不要第21个字段,也是报错。20个varchar(200)成功建表。证明200*200=4000是上限。这是为何?

    如果4000个字节是上限,那么版本是什么dbase?

    实验200个字段可以创建成功char(1),那就说明字段数上限不是128.

    dBASE III 和 IV DBF 格式

    DBF规范dBASE III

    最大字段数为 128
    每个字段最多包含 254 个字符
    每个记录最多包含 4000 个字节

     http://www.dof.ca.gov/Accounting/CALSTARS/Monarch/Monarch_System_Specifications/

    http://johnbrown.com.au/approach/webfaq04040210.html

    • maximum file size = 2 gigabytes (per type .dbf or .dbt file)
    • maximum records per database = 1,000,000,000 (1 billion)
    • maximum of 30 open dBaseIV databases on a single computer
    • maximum number of fields per record = 255
    • maximum size of a record = 4000 characters (= all the field-lengths added together)

    BDE DBF

    http://www.delphigroups.info/2/81/365949.html

    dBASE Limitations
    256 Open dBASE tables per system (16 Bit)
    350 Open dBASE tables per system (BDE 3.0 - 4.0, 32 Bit)
    512 Open dBASE tables per system (BDE 4.01, 32 Bit) (NEW BDE 4.01)
    100 Record locks on one dBASE table (16 and 32 Bit)
    100 Records in transactions on a dBASE table (32 Bit)
    1 Billion records in a table
    2 Billion bytes in .DBF (Table) file
    4000 Size in bytes per record (dBASE 4)
    32767 Size in bytes per record (dBASE for Windows)
    255 Number of fields per table (dBASE 4)
    1024 Number of fields per table (dBASE for Windows)
    47 Number of index tags per .MDX file
    254 Size of character fields
    10 Open master indexes (.MDX) per table
    220 Key expression length in characters

    http://edn.embarcadero.com/article/15159

    DBASE LIMITS
    256      Open dBASE tables per system (16 Bit)
    350      Open dBASE tables per system (BDE 3.0 - 4.0,32 Bit)
    512      Open dBASE tables per system (BDE 4.01, 32 Bit)
    100      Record locks on one dBASE table  (16 and 32 Bit)
    100      Records in transactions on a dBASE table (32 Bit)
    1      Billion records in a table
    2      Billion bytes in .DBF (Table) file
    4000      Size in bytes per record (dBASE 4)
    32767      Size in bytes per record (dBASE for Windows)
    255      Number of fields per table (dBASE 4)
    1024      Number of fields per table (dBASE for Windows)
    47      Number of index tags per .MDX file
    254      Size of character fields
    10      Open master indexes (.MDX) per table
    220      Key expression length in characters

    http://www.dbase.com/help/BDE_Limits/IDH_BDE_LIMITS.htm

  • 相关阅读:
    Linux设置高分辨率后无法进入X系统
    C++中struct和class的总结
    Jenkins 使用slave管理进行持续集成测试说明
    从BUG工具redmine上获取数据后借助python模块pycha 画出BUG分析类报表,利用xlsxwriter
    生成jmeter可用文件和必要参数化的csv
    从BUG工具redmine上获取数据后借助python模块pycha 画出BUG分析类报表
    遍历jenkins build后的文件夹,找出最新“build NO.”复制到制定目录进行操作
    计算http接口签名,并驱动其参数进行测试
    举一反三,取buglist中的url
    测试sq3数据库,读取数据库把内容输出到csv文件,附上输出到excel方法
  • 原文地址:https://www.cnblogs.com/cb168/p/6696699.html
Copyright © 2011-2022 走看看