Home DADE
New Blog Posts: Merging Reports - Part 1 and Part 2

Some DADE Unicode related errors in RB11/D2009 (lower priority)

edited November 2008 in DADE
To reproduce errors please follow:
1. Create simple project with TADOConnection and connect it to some MS SQL
Server database. The database should containts at least one table with one
record (i.e. MyOneLineTable)
2. Create an empty report.
3. Open Report Designer and switch to "Data" tab.
4. In File/Data Settings configure connection to
ADOSession/MyADOConnection/MSSQLServer.

Error #1: Cannot enter SQL statement containing only SELECT part (allowed
for MS SQL)
5. Create new query by File/New/Query Designer
6. Switch to SQL tab, right click to empty command area and click "Edit
SQL". Confirm the warning.
7. Name the Query to 'Sample'
8. Enter command: SELECT 'some text' AS SomeText
9. Press OK. Event the syntax is acceptable by MS SQL Server, the designer
raises an exception:
---------------------------
SQL
---------------------------
Invalid SQL statement.

Access violation at address 10CC2260 in module 'rbDAD1112.bpl'. Read of
address 00000010
---------------------------
OK
---------------------------

Error #2: Non-ascii characters doubling while typing SQL command
10. For this error you will need to install non-English keybord layout, in
my case Czech (Windows Vista Ultimate)
11. Change the SQL command to: SELECT 'Príklad' AS SomeText FROM
MyOneLineTable
- please, type the word "Príklad" on the keyboard
- it is possible to reproduce the error using RightAlt+number
combinations, i.e. RightAlt + 1 produces char ? that will be doubled

Error #3: Cannot create query to MS SQL server table containing fields like
Field1, Field2 etc
12. Change the SQL command to: SELECT 'Sample' AS Field1 FROM MyOneLineTable
13. After confirmation the field will be renamed to Field1_1 and will be
unaccessible.
- same for Field2 etc.
- same for external tables

Comments

  • edited November 2008


    Try downloading RB 11.01 and retest. In my testing here, no error occurs.


    Still needs to be researched, will post a follow up here later.


    This appears to be a behavior of Delphi TADOQuery. I created the test case
    shown below. There are two buttons. When ADOQuery is created in code, the
    behavior you describe occurs. When ADOQuery is placed on the form at Delphi
    design-time, then the TField.FieldName contains the alias specified in the
    SQL. (The code for TdaADODataSet.GetFieldsForSQL located in daADO.pas is
    similar to the Button1Click test code).

    unit Unit1;

    interface

    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls, DB, ADODB;

    type
    TForm1 = class(TForm)
    ADOQuery1: TADOQuery;
    Button1: TButton;
    euDatabase: TADOConnection;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    private
    { Private declarations }
    public
    { Public declarations }
    end;

    var
    Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TForm1.Button1Click(Sender: TObject);
    var
    lQuery: TADOQuery;
    lsSQLText: String;
    begin

    lsSQLText := 'Select ''Sample'' as Field1 from myOneLineTable';

    {create a temporary ADO query}
    lQuery := TADOQuery.Create(Self);

    try

    {assign databae and SQL properties}
    lQuery.Connection := euDatabase;
    lQuery.SQL.Text := lsSQLText;

    {set query to active}
    lQuery.Active := True;

    ShowMessage(lQuery.Fields[0].FieldName); // Field1_1

    finally
    lQuery.Free;

    end;

    end;

    procedure TForm1.Button2Click(Sender: TObject);
    begin
    ADOQuery1.SQL.Text := 'Select ''Sample'' as Field1 from myOneLineTable';
    ADOQuery1.Active := True;
    ShowMessage(ADOQuery1.Fields[0].FieldName); // Field1

    end;

    end.





    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2008


    There is a new RB 11.01 build on the server that includes a fix for the SQL
    Editor and RAP Code Editor.

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.