.NET Zip component, Delphi Zip component, Barcode .NET, BDE Replacement and other .NET and Delphi components from ComponentAce
Products Download Order Contact us

Search
 

Delphi/C++ Components
.NET Components
ActiveX Controls
Kylix Components

Download

Download
Download Commercial
Trial Limitations

Support

Submit Request
Support Options

Order

Purchase
Competitive Upgrade
Premium Support
Sales Policy
Upgrade Policy
License Types

Info

News
Mailing List
Articles
Testimonials



About Us
Partners
Links
Contact Us
Link to Us





Home > Delphi/C++ Components > Absolute Database > Unicode Delphi Example

Absolute Database

Overview | Features | Requirements | Testimonials | SQL Samples | Code Samples | Screenshots | See Also | Download | Order
Absolute Database and Unicode data
Illustrates how to work with Unicode data.

Download Absolute Database | Learn more

unit uMain;

interface
{$I CompVer.inc}

uses
{$IFDEF D6H}
  Variants,
{$ENDIF}
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, ShellApi, StdCtrls, Grids, DBGrids, TntDBGrids, DB, ABSMain,
  TntStdCtrls;

const
  DataBaseFileName: String = '..\..\Data\Demos.abs';

type
  TForm1 = class(TForm)
    GroupBox2: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    dbgDictionary: TTntDBGrid;
    dbDemos: TABSDatabase;
    dsDictionary: TDataSource;
    edWord: TTntEdit;
    cbLanguage: TComboBox;
    btnTranslate: TButton;
    qryTranslate: TABSQuery;
    tblDictionary: TABSTable;
    Label3: TLabel;
    Label4: TLabel;
    dbgTranslation: TTntDBGrid;
    dsTranslate: TDataSource;
    Label5: TLabel;
    procedure Label2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure btnTranslateClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

type

  TLanguagesNumbers = packed record
    LangFrom, LangTo: Word
  end;

{$R *.dfm}

procedure TForm1.Label2Click(Sender: TObject);
begin
  ShellExecute(Handle, 'open', 'http://tnt.ccci.org/delphi_unicode_controls/?ref=www.componentace.com',
    nil, nil, SW_SHOWNORMAL);
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  I, J: Integer;
  L: TLanguagesNumbers;
begin
  dbDemos.DatabaseFileName := ExtractFilePath(Application.ExeName) + DataBaseFileName;
  tblDictionary.Open;
  // fill cbLanguage combo
  for I := 0 to tblDictionary.FieldCount - 1 do
    for J := 0 to tblDictionary.FieldCount - 1 do
      if I <> J then
      begin
        L.LangFrom := I;
        L.LangTo := J;
        cbLanguage.AddItem(tblDictionary.Fields[I].FieldName + ' to ' +
          tblDictionary.Fields[J].FieldName, TObject(L));
      end;
  cbLanguage.ItemIndex := 0;
end;

procedure TForm1.btnTranslateClick(Sender: TObject);
var
  L: TLanguagesNumbers;
begin
  qryTRanslate.Close;
  L := TLanguagesNumbers(cbLanguage.Items.Objects[cbLanguage.ItemIndex]);

  // dynamically create query like
  // SELECT English, German FROM dictionary WHERE English LIKE :Word

  qryTRanslate.SQL.Text := 'SELECT ' + tblDictionary.Fields[L.LangFrom].FieldName +
    ', ' + tblDictionary.Fields[L.LangTo].FieldName +
    ' FROM Dictionary WHERE ' + tblDictionary.Fields[L.LangFrom].FieldName +
      ' LIKE ' + ':Word';

  // assign Word parameter
    qryTRanslate.ParamByName('Word').Value := '%' + edWord.Text + '%';
  qryTRanslate.Open;
end;

end.



Unicode Delphi Example

Download Absolute Database | Learn more


Product Info


Current version: 7.95
Released: February 08, 2023
Price: $ 149

downloadorder


Our Customers



Testimonials

Thanks again for the superb tech support, I was worried I'd hit a brick wall this close to the finish line. Even working on the weekend... you guys rock!!!

Bob Boyd

        © 2003 - 2024 ComponentAce  | .net zip component | barcode for .net | delphi zip component | delphi database Oct 06, 2024