Thema: Delphi TQuery ersetzen

Einzelnen Beitrag anzeigen

Dirk_B

Registriert seit: 15. Aug 2006
36 Beiträge
 
#8

Re: TQuery ersetzen

  Alt 30. Aug 2006, 18:47
Zitat von hoika:
Hallo Dirk,


TStrings geht nicht.

SQL.Add muss auch gehen.

Heiko
Warum geht TStrings nicht? Sieh Dir diesen quick and dirty Code an.

Code:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  TBaseClass = class(TObject)
    fSQL : TStrings;
  private
    function GetSQL: TStrings;
    procedure SetSQL(const Value: TStrings);
  public
    { Public declarations }
  property SQL : TStrings read GetSQL write SetSQL;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

{ TBaseClass }

function TBaseClass.GetSQL: TStrings;
begin
  Result:=fSQL;
end;

procedure TBaseClass.SetSQL(const Value: TStrings);
begin
  fSQL:=Value;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  with TBaseClass.Create do begin
       SQL:=ListBox1.Items;
       SQL.Add('aa');
  end;
end;

end.
Mfg

DB
  Mit Zitat antworten Zitat