Delphi 打开dfm文件时出现TSQLConnection DriverName访问冲突错误

Delphi 打开dfm文件时出现TSQLConnection DriverName访问冲突错误,delphi,delphi-xe4,Delphi,Delphi Xe4,打开dfm时,我遇到以下错误: Error reading TSQLConnection1.DriverName: Access violation at address 5147cB94 in module dbexpress180.bpl. Read of address 0000008. Ignore the error and Continue? dfm文件的内容: object TSQLConnection1: TSQLConnection ConnectionName =

打开dfm时,我遇到以下错误:

Error reading TSQLConnection1.DriverName: Access violation at address 5147cB94 in module dbexpress180.bpl. Read of address 0000008. Ignore the error and Continue?
dfm文件的内容:

object TSQLConnection1: TSQLConnection
    ConnectionName = 'AS400'
    DriverName = 'CA400'
    GetDriverFunc = 'getSQLDriverCA400'
    LibraryName = 'dbexpca400.dll'
    LoginPrompt = False
    Params.Strings = (
      'DriverName=CA400'
      'Database=ABC'
      'User_Name='
      'Password='
      'ServerCharSet='
      'ErrorResourceFile='
      'LocaleCode=0000'
      'BlobSize=-1'
      'RowsetSize=-1'
      'RoleName='
      'CA400 TransIsolation=DirtyRead'
      'CommitRetain=True'
      'AutoCommit=True'
      'Custom String=/trace=0'
      'Connection Timeout=-1'
      'UseUnicode=False'
      'Trim Char=False')
    VendorLib = 'cwbdb.dll'
    BeforeConnect = TSQLConnection1BeforeConnect
    Left = 32
    Top = 24
  end

借助Arioch的评论“可能CA400驱动程序未在该windows上的db Express配置中注册”,我能够解决我的问题

我查看了位于
C:\Users\Public\Documents\RAD Studio\dbExpress\11.0
dbxdrivers.ini
文件,没有安装驱动程序CA400。我找到了下面关于codegear的文章:

这里提到了安装CA400驱动程序的所有步骤。根据文章,

  • 从embarcadero()下载了最新版本的dbexpca400.dll,将其解压缩并放入
    C:\Windows\System32
    文件夹中

  • 将以下代码放入我的dbxdrivers.ini文件中

  • [CA400]

    GetDriverFunc=getSQLDriverCA400
    LibraryName=dbexpca400.dll
    VendorLib=cwbdb.dll
    Database=MYAS400
    User_Name=
    Password=
    ServerCharSet=
    ErrorResourceFile=
    LocaleCode=0000
    BlobSize=-1
    RowsetSize=-1
    RoleName=
    CA400 TransIsolation=DirtyRead
    CommitRetain=True
    
    AutoCommit=True
    Custom String=/trace=0
    Connection Timeout=-1
    Trim Char=False
    
    [CA400 TransIsolation]
    DirtyRead=0
    ReadCommited=1
    RepeatableRead=2
    

    错误得到解决。

    在运行时添加组件,并使用调试器收集更多信息。您可能希望启用调试DCU。可能CA400驱动程序未在该windows上的db Express配置中注册?正在读取nil对象的某些属性,因此DBX中的某些类工厂可能返回nil,而不是实例或对象class@Arioch“您能更详细地解释一下您的陈述吗?”“读取地址0000008”几乎可以肯定类似于读取
    TList(nil).Count
    -其他类和其他属性,但想法相同。“类工厂”是一种众所周知的模式,在DB Express中大量使用。应在windows global DB Express配置中注册特定SQL Server的驱动程序。是否尝试创建新项目;是否添加TSQLConnection并复制此错误?如果它在新项目中运行良好,请尝试从DFM中删除TSQLConnection并再次添加它