Autor Beitrag
foxy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Mo 10.02.03 12:07 
Guden ich hab ne IB Database...
ich will die nun filtern aber wie stell ich das an

erst hatte ich es so
ausblenden Quelltext
1:
2:
3:
4:
Dm.Firmendb.Filtered:= False;
                Dm.Firmendb.Filter:='Produktarten='+QuotedStr(Edit3.Text);
                Dm.Firmendb.Filtered:=true;
                Pagecontrol1.ActivePageIndex:=2;


dann hab ich mir überlegt mit sql zu arbeiten
ausblenden Quelltext
1:
Dm.Firmendb.execSQL 'SELECT * FROM FIRMEN WHERE FIRMA="Edit3.Text"'					

geht auch nicht .... iss da was falsch??

FirmenDB ist ein dataset

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)
Lake
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 78


D6 prof., Delphi 10.2 Tokyo
BeitragVerfasst: Mo 10.02.03 12:44 
Hallo,

beim ersten kann ich jetzt mal keinen Fehler feststellen. Beim zweiten muss der SQL-String wie folgt lauten
ausblenden Quelltext
1:
'SELECT * FROM FIRMEN WHERE FIRMA='+QuotedStr(Edit3.Text);					


Bei Deiner schreibweise hat die Anweisung nach dem Begriff "Edit3.Text" gesucht nicht nach dem was in dem Feld Edit3 eingegeben wurde.

mfg
Lake
foxy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Mo 10.02.03 12:57 
hm ok thx aber das erste geht ga nicht ..... und das 2. versuch ich glei mal

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Mo 10.02.03 13:16 
Hallo foxy,

eine SELECT-Anweisung ruft man nicht mit Query.ExecSQL auf, sondern mit Query.Open.

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
foxy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Mo 10.02.03 13:17 
hmm gut zu wissen .. :) aber ich benutze ja dataset, da ich bei IB keine query verwende

aber ich versuchs ma


wie kann ich das wieder rückgängig machen, also wenn ich den filter aufheben will?

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Mo 10.02.03 13:18 
Hallo,

Filtered:=False ;-)

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
foxy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Mo 10.02.03 13:19 
also so, wie ich das oben im bsp. schon habe dann nur noch die SQL anweisung da rein machen anstatt
ausblenden Quelltext
1:
Dm.Firmendb.Filter:='Produktarten='+QuotedStr(Edit3.Text);					
meinst du das??? :D wenn ja isses gut h3h3

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Mo 10.02.03 13:22 
Hallo foxy,

sorry, aber ich verstehe nicht genau was Du jetzt willst ? :roll:

Kannst Du das noch mal genauer präzisieren. Welche Vorgehensweise: Filter oder SQL?

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
foxy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Mo 10.02.03 13:26 
okö :rofl:
soooo
also mir ist das eigentlich total egal wie ich das mache es soll einfach nur gehn... ich will das wenn ich z.b. nach firmen will filtern

ich gebe ein
"Firma" ----> wähle combobox aus, in welcher spalte gesucht werden soll ---> alle anzeigen die mit dem Buchstaben beginnen (Im dbGrid)

verstanden?? :D

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Mo 10.02.03 13:47 
Hallo,

folgend ein Vorschlag, der eine Query benutzt:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
...
with Query1 do
begin
  Close;
  SQL.Clear;
  SQL.Add('SELECT * FROM FIRMEN WHERE FIRMA='+QuotedStr(Edit3.Text));
  Open;
end; // with Query1
...



Und folgend, man sollte Deine Frage besser lesen, für Anfangsbuchstaben:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
...
with Query1 do
begin
  Close;
  SQL.Clear;
  SQL.Add('SELECT * FROM FIRMEN WHERE FIRMA LIKE '+QuotedStr(Edit3.Text)+'%');
  Open;
end; // with Query1
...

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
foxy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Mo 10.02.03 14:08 
ja so hätt ich das auch gemacht nur bei dataset gibts keine .SQL anweisung ;)

da gibt es .SelectSql iss, dass das selbe?? naja ich versuche es ma weiter dennoch thx ;)

Nachtrag :

habe das nun versucht mein code sieht so aus
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
with DM.Firmendb do
                begin
                     close;
                     SelectSQL.Clear;
                     SelectSQL.Add('SELECT * FROM FIRMEN WHERE FIRMA LIKE '+QuotedStr(Edit3.Text)+'%');
                     Open;
                end;

dennoch kommt ein dynamic SQL fehler

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)
foxy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Mo 10.02.03 15:35 
jaa ich habs jetzt .... nur Smiegel das "%" zeichen ruft einen SQL fehler auf ... also ich muss den ganzen text eingeben dann ist es gefiltert ... und aufheben kann ich es auch nicht mit .filtred:=false .... wie mach ich das ... die 2 sachen dann bin ich glücklich :rofl:

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Mo 10.02.03 15:50 
Hallo foxy,

bei einer SQL kannst Du den Filter nicht mit Filtered:=False ausschalten. In Deinem Fall musst Du ein SELECT-Statement benutzen, dass Dir die gewünschten Daten anzeigt, ohne eine WHERE-Einschränkung.

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
foxy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Mo 10.02.03 15:57 
asoooo ok ok ... aber kannst du mir noch sagen, wie ich das mit den buchstaben mache?? das wenn ich a eingebe auch alles mit A erscheint?? mit dem % ging das nich da kam immer SQL error

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Mo 10.02.03 16:04 
Hallo,

versuche einmal statt '%' das Zeichen "*" oder Du versuchst noch folgendes:

ausblenden Quelltext
1:
SelectSQL.Add('SELECT * FROM FIRMEN WHERE FIRMA LIKE '+QuotedStr(Edit3.Text+'%'));					

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
foxy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Di 11.02.03 10:01 
jopp thx geht soweit .... nur wenn ich die filterung wieder auflösen will, dann ruf ich doch eigentlich die ganz normale Select wieer auf oder?

also

ausblenden Quelltext
1:
Dm.Firmendb.SelectSQL.Text := 'Select FIRMA,STANDORT,PLZ,ADRESSE,TELENR,PRODUKTART,PREISKLASSE,FILES,ID from FIRMEN where FIRMA = :FIRMA ';					


oder was anderes???

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)
kiwicht
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1021

Win 7, MacOS
Delphi x, VBA, PHP, ...
BeitragVerfasst: Di 11.02.03 11:11 
wenn ich da auch noch meinen Senf zu geben dürfte:

1. ich würd empfehlen, die QuotedStr-Sachen nicht mit in die SQL-Anweisung einzubauen, das wird nämlich gerade bei größeren SQL-Abfragen sehr sehr unübersichtlich...

2. benutzte doch zusätzlich noch UpperCaser bzw. AnsiUpperCase, als Ersatz für die fehlende Eigenschaft CaseInsensitive. soll heissen, das deine Eingabe und der Inhalt des zu durchsuchenden feldes in gróßbuchstaben umgewandelt werdebn. arbeitest du mit deutschen umlauten, benutzte aufjedenfall AnsiUpperCase, sonst kommt es zu komplikationen.

und 3., zu deiner Letzten frage: eigentlich richtig dein code, klappts denn etwa nicht?

mal als beispiel zu 1 u 2:
ausblenden Quelltext
1:
2:
3:
4:
Eingabe := QuotedStr('%' + AnsiUpperCase(Edit1.Text) + '%');

SQL.Text := 
'SELECT * FROM firmen WHERE upper(firma) LIKE ' + Eingabe;


find ich persönlich um einiges übersichtlicher....

idS
kiwicht
foxy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Di 11.02.03 11:28 
ne geht nicht .... ich hab mich auch gewundert .... aber ka was das ist ... ich versuch das mal weiter

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)
kiwicht
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1021

Win 7, MacOS
Delphi x, VBA, PHP, ...
BeitragVerfasst: Di 11.02.03 11:53 
versuch doch erstmal das normale SQL-Gebamsel, ob das geht:

SQL.Text := 'SELECT * FROM firmen';

weil wenn das nicht geht, dann stimmt tatsächlich irgendetwas ganz gewaltig nicht.. 8)


mfg
foxy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 814

Ubuntu, Gentoo
C++, PHP, Java, Ruby, Perl (Eclipse)
BeitragVerfasst: Di 11.02.03 11:58 
kiwi der filtert sortiert das geht alles .....
nur wenn der gefiltert hat will ich das ja wieder aufheben, das ich alles wieder sehe ... das geht nur nicht die anderen befehle gehen ja

_________________
"Only wimps use tape backup: real men just upload their important stuff on ftp, and let the rest of the world mirror it." (Linus Torvalds)
OperatingSystem Laptop (Ubuntu Hardy)