4

TSQLDataSet我的 Delphi 7 应用程序中有以下内容。它从表 MyTable 中获取 2 个字段(ID 和名称)。

object SQLDataSet: TSQLDataSet
    GetMetadata = False
    CommandText = 'select * from MyTable'
    MaxBlobSize = -1
    Params = <>
    SQLConnection = mySQLConnection

    object SQLDataSetID: TIntegerField
      FieldName = 'ID'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object SQLDataSetNAME: TStringField
      FieldName = 'NAME'
      Required = True
      Size = 50
    end
end

当我迁移到 Delphi XE4 时,出现以下错误:

class EDatabaseError with message 'SQLDataSet: Type mismatch for field 'NAME', expecting: String actual:WideString'

这个问题的可能原因是什么,我应该如何摆脱它?

注意:我正在使用firebird 2.5.2.

4

1 回答 1

1

更改TStringFieldTWideTStringfield

object SQLDataSet: TSQLDataSet
    GetMetadata = False
    CommandText = 'select * from MyTable'
    MaxBlobSize = -1
    Params = <>
    SQLConnection = mySQLConnection

    object SQLDataSetID: TIntegerField
      FieldName = 'ID'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object SQLDataSetNAME: **TWideStringField**
      FieldName = 'NAME'
      Required = True
      Size = 50
    end
end
于 2015-07-08T23:21:28.953 回答