Delphi XE Unicode dealing with nchar(1) fields

797 Views Asked by At

I'm using a dbGo TADODataset in Delphi XE to read data from a SQL Server 2008 table. All the string fields are nvarchar or nchar.

The nvarchar fields map to TWideStringField with no problems.

The problem is with an nchar(1) field, this maps to a TStringField fine but not to a TWideStringField - when I configure the field to be TWideStringField I get the error:

Type mismatch for field 'foobar', expecting: WideString actual: FixedChar

The problem in using a TStringField is that it is UTF8 and we want to make our application fully unicode compliant.

Any suggestions on this?

1

There are 1 best solutions below

0
On

Hmmm. That field is used for what, exactly?

In most db designs I've seen, an (n)Char(1) field are normally used for one-letter flags - which can be easily represented in an ASCII char.

I would recomend change the type of the column to CHAR(1), if that's the case.