Autor Beitrag
pitty69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39


D4
BeitragVerfasst: Mo 06.09.04 12:09 
Hallöle an alle,

ich habe da noch ein paar fragen...eben noch immer eine blutige Delphi Anfängerin..

Ich habe zwei TQuery für eine Abfrage benutzt die mir einen Datensatz aus zwei Tabellen zusammenstellt.... anhand des Vergleiches zwischen zwei ID´s...

Nun möchte ich eine Suche realisieren.... Brauche ich ein neues TQuery?
Wie baue ich die SQL Befehle in meinem Unit ein, möchte das nicht immer in der Stringliste schreiben....

_________________
Gruß pitty69
MisterBum83
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 245
Erhaltene Danke: 2

WIN XP
Delphi 6
BeitragVerfasst: Mo 06.09.04 12:29 
Ein neues TQuery wäre besser.

Mit dem Befehl TQuery.SQL.Add kannst du den Befehl ins Query schreiben und mit TQuery.Execute ausführen. Mach vor dem Add besser immer ein Clear zum "säubern'.

Gruß MisterBum
neojones
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1206
Erhaltene Danke: 1



BeitragVerfasst: Mo 06.09.04 12:29 
Zum Suchen: Schau Dir mal die Methode "Locate" an, da solltest alles mit machen können.

_________________
Ha! Es compiliert! Wir können ausliefern!
pitty69 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39


D4
BeitragVerfasst: Mo 06.09.04 12:33 
Danke erstmal für eure schnelle Hilfe...
Werde es mir gleich mal anschauen....
Für weitere Lösungsvorschläge bin ich offen...

_________________
Gruß pitty69
pitty69 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39


D4
BeitragVerfasst: Mo 06.09.04 12:46 
neojones hat folgendes geschrieben:
Zum Suchen: Schau Dir mal die Methode "Locate" an, da solltest alles mit machen können.


Sag mal kann das sein das ich bei Delphi 1 die Methode nicht zur Verfügung habe, würde mich zwar wundern aber habe in der Hilfe zu dieser Methode nix gefunden!!!

_________________
Gruß pitty69
grayfox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 800

win98, winXP
D4 Standard; D6 Personal
BeitragVerfasst: Mo 06.09.04 12:50 
hallo pitty!

so trifft man sich wieder! ;)

hast du unter 'TQuery.Locate' oder nur unter 'Locate' gesucht?

mfg, stefan
pitty69 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39


D4
BeitragVerfasst: Mo 06.09.04 12:56 
grayfox hat folgendes geschrieben:
hallo pitty!

so trifft man sich wieder! ;)

hast du unter 'TQuery.Locate' oder nur unter 'Locate' gesucht?


schön dich wieder zu lesen... :D

Habe erst nach TQuery.Locate gesucht und dann bei TQuery nach den Methoden gesucht.....

:( Leider ohne Erfolg!

_________________
Gruß pitty69
grayfox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 800

win98, winXP
D4 Standard; D6 Personal
BeitragVerfasst: Mo 06.09.04 13:29 
schade, schade...

versuch es mal mit lookup....

//edit: nachdem du aber nur etwas in deiner abfrage suchen möchtest, kannst ja auch 'filter' verwenden.
ich hoffe, dass D1 'Filter' kennt.
pitty69 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39


D4
BeitragVerfasst: Mo 06.09.04 13:32 
Danke für deine Tips suche dann mal weiter! Gebe dir bestimmt noch bescheid ob D1 'Filter' kennt. Nur falls dich jemand mal fragt :wink:

_________________
Gruß pitty69
pitty69 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39


D4
BeitragVerfasst: Mo 06.09.04 13:33 
grayfox hat folgendes geschrieben:
schade, schade...

versuch es mal mit lookup....

//edit: nachdem du aber nur etwas in deiner abfrage suchen möchtest, kannst ja auch 'filter' verwenden.
ich hoffe, dass D1 'Filter' kennt.


schade schade aber D1 kennt beides offenbar nicht!
Jemand eine Idee wie das ersetzen kann?

_________________
Gruß pitty69
grayfox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 800

win98, winXP
D4 Standard; D6 Personal
BeitragVerfasst: Mo 06.09.04 13:46 
Zitat:
Jemand eine Idee wie das ersetzen kann?


nööö! :wink:

wenn alle stricke reissen, kannst du auch noch zu fuss durch deine datenmenge iterieren und den gewünschten begriff suchen, zb

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
  fertig:= false;
  while not query.eof or fertig do begin
    fertig:= (query.FieldByName('Zuname').asString = Suchbegriff);
    query.next
  end;

  if fertig then 
    ShowMessageBox(Format('Der Name %s wurde gefunden',[Suchbegriff]))
  else
    ShowMessageBox(Format('Der Name %s wurde nicht gefunden',[Suchbegriff]));


aber von mir hast du diesen code nicht bekommen ;)

schau mal in den beispielen nach, die bei D1 dabei sind. dort muss doch auch irgendwas übers suchen zu finden sein.

mfg, stefan
pitty69 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39


D4
BeitragVerfasst: Mo 06.09.04 13:58 
Wieso hab ich das denn nicht von dir???? :?

Aber ich guck einfach ob es klappt, danke erstmal....

_________________
Gruß pitty69
grayfox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 800

win98, winXP
D4 Standard; D6 Personal
BeitragVerfasst: Mo 06.09.04 14:18 
Zitat:
Wieso hab ich das denn nicht von dir???

weil ich mich sonst genieren muss, falls du das herumerzählst ;)

kennt D1 vielleicht 'FindFirst & FindLast'?
wenn es dir gelingt, die tabelleneinträge, nach denen du suchen willst,zu indizieren, dann könntest duch FF & FL einsetzen. bei grossen datenbeständen ist das bestimmt um einiges schneller als meine vorgeschlagene version.

mfg, stefan
pitty69 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39


D4
BeitragVerfasst: Di 07.09.04 07:30 
grayfox hat folgendes geschrieben:

kennt D1 vielleicht 'FindFirst & FindLast'?


Deine Version die du zuvor vorgeschlagen hast, fand ich garnicht so schlimm! Und zu allem Übel kennt D1 'FindFirst & FindLast' nicht... :-(
Langsam frage ich mich ob es eine gute Idee war mit Delphi 1 zu beginnen.....

_________________
Gruß pitty69
MisterBum83
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 245
Erhaltene Danke: 2

WIN XP
Delphi 6
BeitragVerfasst: Di 07.09.04 11:40 
Wie wärs mit einem TQuery und dort über einen SQL-Befehl suchen lassen...
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
Query1.SQL.Clear;
Query1.SQL.Add('Select * from Tabelle where (ID='5') and (Kurzbegriff='Delphi')');
Query1.Execute;
if Query1.RecordCount=0 then
showmessage('Kein Ergebnis gefunden!');


...und schon hast du ein Suchergebniss!

Gruß MisterBum

Moderiert von user profile iconUGrohne: Delphi-Tags hinzugefügt.
pitty69 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39


D4
BeitragVerfasst: Di 07.09.04 11:47 
Vielen Dank MisterBum83!!!
Ich hoffe ich bekomme das hin!

_________________
Gruß pitty69
pitty69 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39


D4
BeitragVerfasst: Di 07.09.04 11:54 
Titel: Fehlermeldung
MisterBum83 hat folgendes geschrieben:

Query1.Execute;


Das gibt bei mir ne Fehlermeldung!
Feldbezeichner erwartet!!!! :cry:

_________________
Gruß pitty69
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Di 07.09.04 11:56 
Soweit ich weiß, heißt die Prozedur beim Query:
ausblenden Delphi-Quelltext
1:
Query1.ExecQuery;					
pitty69 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39


D4
BeitragVerfasst: Di 07.09.04 12:00 
UGrohne hat folgendes geschrieben:
Query1.ExecQuery;


Leider ohne Erfolg!!!!
Immernoch wartet er auf einen Feldbezeichner!

_________________
Gruß pitty69
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Di 07.09.04 12:10 
Ach herrje, dann heißts doch
ausblenden Delphi-Quelltext
1:
Query1.ExecSQL;					

Mit den 3en hab ich auch immer Probleme, die sind irgendwie überall unterschiedlich ...