MSSQL 2008 NCHAR (UNICODE) and Delphi 5
-
- Posts: 6
- Joined: Mon 14 Nov 2011 17:32
MSSQL 2008 NCHAR (UNICODE) and Delphi 5
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
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
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.
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.
-
- Posts: 6
- Joined: Mon 14 Nov 2011 17:32
Hello,
Thx for the quick answer!
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
Thx for the quick answer!
I am aware of that and used TNT components for displaying.AndreyZ wrote:Hello,
You are right, you cannot show Unicode characters in visual components in Delphi 5 because Delphi 5 doesn't support Unicode..
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
-
- Posts: 6
- Joined: Mon 14 Nov 2011 17:32
Unfortunately this was not successful.Marcovaldo wrote:
Just tried to :
- Crosscheck LongStrings = true
- Tried to assign a TNT component as default component for the field
Marcovaldo
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
-
- Posts: 6
- Joined: Mon 14 Nov 2011 17:32
1) I placed a TNT DBEdit on form and assigned to DataSource/FieldMarcovaldo wrote:
Didn't get it running properly, but found a workaround (kind of)
(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
-
- Posts: 6
- Joined: Mon 14 Nov 2011 17:32
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
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
-
- Posts: 6
- Joined: Mon 14 Nov 2011 17:32
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
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