我在Delphi 7应用程序中跟随TSQLDataSet
。它从表MyTable中获取2个字段(ID和Name)。
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
。
答案 0 :(得分:0)
将TStringField
更改为TWideTStringfield
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