Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#7

Re: Wie größere SQL Statements schreiben?

  Alt 18. Nov 2009, 11:26
Ich mache es z.B. so:

Delphi-Quellcode:
begin
  query := TQuery.Create(nil);
  try
    with query.sql do
    begin
      Clear;
      Add('SELECT');
      Add(' *');
      Add('FROM tabelle');
      Add('WHERE');
      Add(' (blubb = :blubb) AND');
      Add(' (meow = :meow)');
      Add('ORDER BY wuppdi');
    end;
    query.ParamByName('meow').AsString := 'Test';
    query.ParamByName('blubb').AsInteger := 123;
    query.Open;
      // Etwas tun
    query.Close;
  finally
    query.Free;
  end;
end;
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat