Page 1 of 1

Type do not match to field expected: String actual: Memo

Posted: Thu 02 Dec 2010 17:31
by flaviojr77
When I execute the following SQL from my software (Delphi):

Code: Select all

select id, name
       (select 'Y' from other_table where id = 1) as check
from table_name
The system displays the error message

raised exception class EDatabaseError with message 'Query: Type do not match to field 'check', expected: String actual: Memo'.

In form has 3 fields:

ID: TIntegerField
name: TStringField
check: TStringField <--- here the problem, expected TMemoField

To resolve I changed the code:

Code: Select all

select id, name
       cast((select 'Y' from other_table where id = 1) as varchar(1)) as check
from table_name
The problem: this code occurs in many places in my source code.
Is there a way to configure the Devart (a param) to not show this exception and accept fields of type "text" as a string field?

Before I used the dbExpress component Vitavoom, and never received this error ...

Posted: Wed 15 Dec 2010 12:51
by bork
Hello

Try to set the UnknownAsString parameter to True. This option enables representation of all fields with unknown data type (if PostgreSQL returns unknown type for some column) as string. You can find more detailed information in the Readme.html file in the folder where your dbExpress driver is installed.