Type mismatch for field 'xxx', expecting: WideString actual: String

Development Enviornment

Delphi XE2
oci.dll 11.2.0.1
sqlncli10.dll 2007.100.2531.0 
MS SQL Server 2000, 2005, 2008. Collated Arabic_CI_AS 
Oracle 11g NLS Characterset WE8ISO8859P1 
Application using datasnap/dbexpress driver
Windows XP

Problem Area

We have an application that we are converting to runs on both Oracle and MS SQL Server. 

The Oracle driver brings back Varchar2 as TWideStringField. The SQL Server driver brings back Varchars as TStringField. 

This becomes a problem for our persistent fields. The error we receive is "Type mismatch for field 'xxx', expecting: WideString actual: String." 

I would like to know if we are missing something. 

Steps to reproduct 
This can easily be reproduced by dropping a TSQLConnection and TSQLQuery component on a form. The TSQLQuery selects a table with a simple varchar/varchar2 column. Then you create a persistent field for that column and repeat for each database type. 

I would like to know How we can fix this problem
0
Prakash
11/20/2012 11:42:41 AM
embarcadero.delphi.multi-tier 396 articles. 0 followers. Follow

1 Replies
3454 Views

Similar Articles

[PageSpeed] 31

Am 20.11.2012 12:42, schrieb Prakash Shirodkar:
> The Oracle driver brings back Varchar2 as TWideStringField. The SQL Server driver brings back Varchars as TStringField.
>

You cannot use different databases with persistent fields when the field 
types are different between those databases. String fields and 
WideString fields are different. You can try to use NVARCHAR fields with 
SQL Server.


-- 
Uwe Raabe
Embarcadero MVP
Certified Delphi Master Developer
Uwe's Blog: The Art of Delphi Programming <http://www.uweraabe.de/>
0
Uwe
11/20/2012 1:23:03 PM
Reply: