TADOQuery: 'EDatabaseError type mismatch for f

2019-07-23 03:27发布

问题:

I have 3 different databases (development, homolog and prod), each of them in one of the following Oracle versions: 11g and 10g.

I'm using a TADOQuery to query for some data in only one of those databases at a time.

When I run my app in dev or prod it returns the data perfectly. But when I run it in homolog i get the following error message:

'EDatabaseError type mismatch for field 'MyField', expecting: String actual: FixedWideChar'

I already checked and the DDL is the same for the 3 databases, so it's not a problem of data type. Also, MyField is a CHAR(1) in all of them.

Can anybody help me?

回答1:

Solved the problem! The answer came from this post: http://objectmix.com/ado-dao-rdo-rds/392318-fixedwidechar-adodb-problem.html

I had to fix a bug in the ADODB.pas changing the following line

compatible:= FieldDef.DataType in [ftstring,ftwidestring]

into

compatible:= FieldDef.DataType in [ftstring,ftwidestring,ftfixedWideChar]