Autor Beitrag
hube
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38

WIN XP
D7 Prof
BeitragVerfasst: Mi 13.04.05 19:30 
Hallo zusammen

Ich möchte mir gerne via SQl aus einer Paradox DB alle Datensätze anzeigen lassen, die mit einem bestimmten Buchstaben beginnen.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
begin
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add ('Select * From lager');
Query1.SQL.Add ('WHERE Artikel =' + Edit1.Text);
Query1.Open;
end;


Wenn ich jetzt zum Beispiel "A" in das Edit1 Feld eingebe, dann sollen nur alle Datensätze angezeigt werden, bei welchen das Wort mit "A" beginnt.

Hat jemand eine Idee?

Besten Dank für Euere Hilfe

hube

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.
Moderiert von user profile iconraziel: Topic aus Dateizugriff verschoben am Mi 13.04.2005 um 21:19
Robert.Wachtel
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 895
Erhaltene Danke: 7

Windows 7 Ultimate x64
D5 Ent, D7 Arch, RAD Studio 2010 Pro, VS 2008
BeitragVerfasst: Mi 13.04.05 19:49 
Titel: Re: Alle Datensätze anzeigen die mit einem bestimmten Buchst
user profile iconhube hat folgendes geschrieben:
[...] Ich möchte mir gerne via SQl aus einer Paradox DB alle Datensätze anzeigen lassen, die mit einem bestimmten Buchstaben beginnen. [...]

Stichwort LIKE
hube Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38

WIN XP
D7 Prof
BeitragVerfasst: Mi 13.04.05 19:53 
Ja LIKE kenne ich :lol: , aber dann zeigt es mir alle Datensätze an, bei denen der Buchstabe enthalten ist. Ich suche aber eine Lösung um nur nach dem ersten Buchstaben zu suchen.

Gruss hube
Robert.Wachtel
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 895
Erhaltene Danke: 7

Windows 7 Ultimate x64
D5 Ent, D7 Arch, RAD Studio 2010 Pro, VS 2008
BeitragVerfasst: Mi 13.04.05 20:15 
user profile iconhube hat folgendes geschrieben:
Ja LIKE kenne ich :lol:[...]

Sicher?

Zitat:
aber dann zeigt es mir alle Datensätze an, bei denen der Buchstabe enthalten ist.

Nein.

Zitat:
Ich suche aber eine Lösung um nur nach dem ersten Buchstaben zu suchen.

SELECT * FROM Tabelle WHERE Name LIKE "A%"
hube Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38

WIN XP
D7 Prof
BeitragVerfasst: Mi 13.04.05 20:28 
:D

Super, jetzt geht es. Vielen herzlichen Dank.

hube