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

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for PostgreSQL in Delphi and C++Builder
Post Reply
flaviojr77
Posts: 1
Joined: Thu 02 Dec 2010 17:15
Location: Brasil

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

Post by flaviojr77 » Thu 02 Dec 2010 17:31

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 ...

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Wed 15 Dec 2010 12:51

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.

Post Reply