Page 1 of 1

MSSQL 2008 NCHAR (UNICODE) and Delphi 5

Posted: Mon 14 Nov 2011 17:47
by Marcovaldo
Hello,

We are using Delphi 5 Enterprise and just purchased SDAC for Delphi 5 to
access a table on a MSSQL 2008 R2 server.

Unfortunately the table has NCHAR fields. These are only shown as [MEMO]
in dbtable grid and editor. Could it be that access to UNICODE field types
is not possible using Delphi 5?
(However the Column Editor in Designmode shows correct contents)

Best Regards,

Marcovaldo

Posted: Tue 15 Nov 2011 09:35
by AndreyZ
Hello,

You are right, you cannot show Unicode characters in visual components in Delphi 5 because Delphi 5 doesn't support Unicode. But the problem with the NCHAR field mapped as TMemoField has nothing to do with it. Please check that the TMSQuery.Options.LongStrings property is set to True. This property is used to represent string fields with the length that is greater than 255 as TStringField, not as TMemoField.

Posted: Tue 15 Nov 2011 12:33
by Marcovaldo
Hello,

Thx for the quick answer!
AndreyZ wrote:Hello,

You are right, you cannot show Unicode characters in visual components in Delphi 5 because Delphi 5 doesn't support Unicode..
I am aware of that and used TNT components for displaying.

So by your suggestion I should be able to access the data and
display in a suitable unicode component ? Will give this a try now.

Kind Regards,

Marcovaldo

Posted: Tue 15 Nov 2011 13:48
by Marcovaldo
Marcovaldo wrote:
Just tried to :
- Crosscheck LongStrings = true
- Tried to assign a TNT component as default component for the field
Marcovaldo
Unfortunately this was not successful.
Do you have any information D5 can be used to _retrieve_
Wide Strings (I know about the limitation that the standard VCL doesn't
support Unicode, but I need only the data (which indeed will not be unicode
but I suppose, only ANSI stuffed into NCHAR fields; unfortunately it's a
customers MSSQL server and I cannot change the config..

Best Regards,

Marcovaldo

Posted: Tue 15 Nov 2011 15:00
by Marcovaldo
Marcovaldo wrote:
Didn't get it running properly, but found a workaround (kind of)
1) I placed a TNT DBEdit on form and assigned to DataSource/Field
(This still shows the [Memo] placeholder]

2) somewhere in code I assign:
Edit2.Text := MSQuery1.Fields[2].AsString;
The AsString returns the Field contents OK,
(If the TNTDBEdit switches into Edit mode, however the
content is replaced by '[Memo]' again, but I can prevent this..)

Best Regards,

Marcovaldo

Posted: Tue 15 Nov 2011 16:16
by AndreyZ
I've installed TNT components, but still cannot reproduce the problem. Please specify a script to create your table, and the exact field(s) which values are shown as (MEMO) in the TTntDBEdit and TTntDBGrid components.

Posted: Sun 20 Nov 2011 19:12
by Marcovaldo
Hi Again,

1) Thx for the quick answer and your efforts!
2) Will be at customer again tomorrow and will then be able to post more
information.

=> My last impression was when testing with dbVisualizer is that the
customer defined the view under question using NVARCHAR(max) which
results in a CLOB column. I suppose that this CLOB datatype is what
causes the troubles



Best Regards,

Marcovaldo

Posted: Mon 21 Nov 2011 13:06
by AndreyZ
I'm looking forward to hearing from you.

Posted: Mon 21 Nov 2011 15:08
by Marcovaldo
Hello Andrey,


I just confirmed using your Demoprogram with the registered
Version(I bought the product inbetween):

The issue has only todo with the
CLOB (Unicode character BLOBs) they have created by
selecting NVARCHAR(max) as type for the column.

All other types work properly. In this case the bug is not in your software
but between the ears of the IT-guy who selected this column type
just for short strings like phone numbers....

I have learned to acess the data with the workaround described above.
And I am happy with what works.

Thank you again for great support and the
smoothly working component(and also that
the components are offered for Lazarus too...),

Best Regards,

Marcovaldo

Posted: Mon 21 Nov 2011 15:15
by AndreyZ
It's good to see that the problem was solved. Feel free to contact us if you have any other questions about SDAC.