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

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

Postby 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 ...
flaviojr77
 
Posts: 1
Joined: Thu 02 Dec 2010 17:15
Location: Brasil

Postby 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.
bork
Devart Team
 
Posts: 643
Joined: Fri 12 Mar 2010 07:55


Return to dbExpress driver for PostgreSQL