Page 1 of 1

D6 SDAC Unicode Support? How defined?

Posted: Mon 16 Jul 2007 15:36
by skyhawk64ca
Hello. Can the CoreLab team please define how the advertized "Unicode support" is actually defined for SDAC for D6 and Sql Server?

Is the product capable of storing WideString Unicode data to a database and then retrieving it back as a WideString? If so, what is the secret please. For example, the following query: the [CLIENT] column contains Russian characters. The variant cast to WideString fails. There is no "AsWideString" available for the other method.

Qy.Close;
Qy.SQL.Clear;
Qy.SQL.Add('SELECT [CLIENT]');
Qy.SQL.Add('FROM');
Qy.SQL.Add('SCHEDULE');
Qy.SQL.Add('WHERE [ID] = :P1');
Qy.SQL.Add(' AND [SERVICE_OWNER] = :P2');
Qy.SQL.Add(' AND [SERVICE_GROUP] = :P3');
Qy.ParamByName('P1').Value:=3500;
Qy.ParamByName('P2').Value:='Vladivostok XChange';
Qy.ParamByName('P3').Value:='SMS Testing';
Qy.Execute;
if (Qy.RecordCount=1) then
begin
s:=Qy.FieldValues['CLIENT'].AsWideString; //Fails EVariantInvalidOpError
ws:=Qy.FieldByName('CLIENT').AsString; // s='???????????? ?????? ? 1794 ????'

end // s/b Cyrillic text
s:=православной церкви с 1794 года
else
Result:=-1;
finally

I understand that Delphi controls cannot display the result, but it looks like the Query is losing the Widestring Unicode data.

The product advertises "Unicode support" but it is obviously not FULL Unicode support so can someone kindly outline the limitations. I cannot find this info clearly laid out anywhere.

Thank you,

Mike

=====================================

Key Features



The following list describes the main features of SQL Server Data Access Components.

Direct access to server data. Does not require installation of other data provider layers (such as BDE and ODBC)
VCL, VCL.NET, and CLX versions of library available
Full support of the latest Microsoft SQL Server versions, including Express and Compact Editions
Support for all SQL Server data types
Disconnected Model with automatic connection control for working with data offline
Local Failover for detecting connection loss and implicitly reexecuting certain operations
All types of local sorting and filtering, including by calculated and lookup fields
Automatic data updating with TMSQuery, TMSTable, and TMSStoredProc components
!!!!!!!!!!!!!!!!!!!!!!!
Unicode support
!!!!!!!!!!!!!!!!!!!!!!
Support for many SQL Server-specific features, such as MARS and bulk copy operations
Advanced script execution with TMSScript component
Support for using macros in SQL
Easy migration from BDE and ADO with Migration Wizard
Lets you use Professional Edition of Delphi and C++Builder to develop client/server applications
Includes annual SDAC Subscription with Priority Support
Licensed royalty-free per developer, per team, or per site

Posted: Wed 18 Jul 2007 06:56
by Antaeus
You can use this code:

Code: Select all

var
  ws: WideString;
begin
  MSQuery1.Open;
  ws := (MSQuery1.FieldByName('Description') as TWideStringField).Value;
Or create fields at design time and use the following code:

Code: Select all

type
  TForm1 = class(TForm)
    MSQuery1: TMSQuery;
    MSQuery1Description: TWideStringField;
    ...
var
  ws: WideString;
begin
  MSQuery1.Open;
  ws := MSQuery1Description.Value;