AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Tquery variabel die zweite

Ein Thema von fl63 · begonnen am 26. Mär 2012 · letzter Beitrag vom 27. Mär 2012
 
fl63

Registriert seit: 30. Mär 2008
124 Beiträge
 
#1

Tquery variabel die zweite

  Alt 26. Mär 2012, 12:12
Datenbank: firebird • Version: 2 • Zugriff über: ibx
Hallo!

Ich habe 2 Tabellen in einer Firebird Datenbank.
Jetzt möchte ich beide Tabellen auf einmal abfragen, mit folgendem Quelltext:
Delphi-Quellcode:
procedure TForm1.AbfrageClick(Sender: TObject);
var SQLString1 , SQLString2 :String;
begin
Edit1.Text := AnsiUpperCase(Edit1.Text);
If Combobox1.Text = 'then Combobox1.Text := ' Tabelle1 Tabelle2';
Screen.Cursor := crHourGlass;
If Edit1.Text = 'then Edit1.Text := '..';
If Edit2.Text = 'then Edit2.Text := '..';
SQLString1:= StringReplace(Edit1.Text,'#','_',[rfReplaceAll]);
SQLString1:= StringReplace(SQLString1,'..','%',[rfReplaceAll]);
SQLString2:= StringReplace(Edit2.Text,'#','_',[rfReplaceAll]);
SQLString2:= StringReplace(SQLString2,'..','%',[rfReplaceAll]);
  with Query1 do
  begin
    Active:=False;
    SQL.Clear;
    SQL.Add('Select * from '+ combobox1.text +' where feld001 Like :text1 ');
    SQL.Add('And Upper (feld002) Like Upper (:text2) ');
    ParamByName('text1').asString := SQLString1;
    ParamByName('text2').asString := SQLString2;
    Active:=True;
  end;
Screen.Cursor := crDefault;
end;
Das Problem liegt bei
If Combobox1.Text = 'then Combobox1.Text := ' Tabelle1 and Tabelle2'; Ich habe schon die Möglichkeiten
... 'then Combobox1.Text := ' Tabelle1 and from Tabelle2'; sowie
... 'then Combobox1.Text := ' Tabelle1, Tabelle2'; und einige weitere ausprobiert. Leider ohne Ergebnis.
Manchmal wird Tabelle1 abgefragt und Tabelle2 nicht, meist bekomme ich Fehler 104 .

Ich hoffe auf eure Hilfe.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:30 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz