Autor Beitrag
jazzkeller
Hält's aus hier
Beiträge: 1



BeitragVerfasst: So 16.10.05 12:24 
Hallo Delphi-Gemeinde!

Ich möchte bei der SELECT WHERE Abfrage eine Variable als Suchkriterium benutzen. Leider funktioniert folgender Code da nicht:
ausblenden Delphi-Quelltext
1:
qrSec.SQL.Text:='SELECT * FROM `char` WHERE `user`=ch_user';					


ch_user ist ein string. Ich komme da irgendwie nicht weiter, kann mir da jemand helfen??

Besten Dank schonmal...
...Lukas
the_immortal
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 78



BeitragVerfasst: So 16.10.05 13:02 
versuch es wie folgt:

ausblenden SQL-Anweisung
1:
qrSec.SQL.Text:='SELECT * FROM char WHERE user="' + ch_user + '"';					
tomtom62
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 278

WIN 2000, XP prof
D5 prof.
BeitragVerfasst: So 16.10.05 17:50 
Besser gefällt mir:

ausblenden Delphi-Quelltext
1:
2:
  
qrSec.SQL.Text:='SELECT * FROM char WHERE user='+QuotedStr(ch_user);


:D
the_immortal
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 78



BeitragVerfasst: Mo 17.10.05 09:44 
user profile icontomtom62 hat folgendes geschrieben:
Besser gefällt mir:

ausblenden Delphi-Quelltext
1:
2:
  
qrSec.SQL.Text:='SELECT * FROM char WHERE user='+QuotedStr(ch_user);


:D


QuotedStr ist einfach mit Hochkomma?

Normalerweise, das heisst in PHP verwende ich auch immer Hochkomma, aber in Delphi kommt es auf dasselbe raus oder?