Autor Beitrag
Andi1982
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 497

WinXP HE
D6 Enterprise
BeitragVerfasst: Do 22.05.03 19:22 
Hallo,
ich habe eine MP3 Datenbank mit einer suchfunktion aus folgendem Select:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.BitBtn1Click(Sender: TObject);
var Bed1, Bed2: String;
begin
   Bed1 := QuotedStr('%' + Edit1.Text + '%');
   Bed2 := QuotedStr('%' + Edit2.Text + '%');
   query1.Active := False;
   query1.SQL.Text := 'Select * From Lieder.db ' +
                      'where Titel LIKE ' + Bed1 +
                      ' and Interpret LIKE ' Bed2;
   query1.Active := True;
end;


Aber wenn jetzt in der Tabelle "Shadows of the Night" eingebe und mit "shadow" suche, findet er es nicht. Kann man die gross/kleinschreibung irgendwie übergehen? MIt der Suchfunktion hier im Forum gehts ja auch wenn man alle klein eingibt.

Gruß Andi


Moderiert von user profile icontommie-lie: Code- durch Delphi-Tags ersetzt

_________________
Solange die Bombe tickt ist alles in Ordnung, erst wenn sie damit aufhört wird es problematisch...
Luncustaf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 324

Win 2k
D7 Ent.
BeitragVerfasst: Do 22.05.03 19:38 
hi

use UpperCase and LowerCase

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.BitBtn1Click(Sender: TObject); 
var Bed1, Bed2: String; 
begin 
   Bed1 := QuotedStr('%' + Edit1.Text + '%'); 
   Bed2 := QuotedStr('%' + Edit2.Text + '%'); 
   query1.Active := False; 
   query1.SQL.Text := 'Select * From Lieder.db ' + 
                      'where Titel LIKE ' + LowerCase(Bed1) + //alles wird klein
                      ' and Interpret LIKE ' UpperCase(Bed2); //alles wird groß
   query1.Active := True; 
end;



gr€€tz

Moderiert von user profile iconUGrohne: Code- durch Delphi-Tags ersetzt
Andi1982 Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 497

WinXP HE
D6 Enterprise
BeitragVerfasst: Do 22.05.03 19:49 
Ja aber wenn ich in der Spalte Titel jetzt "Shadows of the night" drinstehen habe und mit "SHADOW" oder "shadow" suche findet er es aber genauso wenig. Das ist ja mein problem. In manchen SQL gibt es diese möglichkeit:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
Sourcecode: 
procedure TForm1.BitBtn1Click(Sender: TObject); 
var Bed1, Bed2: String; 
begin 
   Bed1 := QuotedStr('%' + Edit1.Text + '%'); 
   Bed2 := QuotedStr('%' + Edit2.Text + '%'); 
   query1.Active := False; 
   query1.SQL.Text := 'Select * From Lieder.db ' + 
                      'where Titel LIKE ' + Bed1 + 
                      ' and Interpret LIKE ' + Bed2 +' no_case'; 
   query1.Active := True; 
end;


Also einfach ein No_case hinten dran hängen. Aber meine BDE (paradox 7) will das nicht!

Moderiert von user profile iconUGrohne: Code- durch Delphi-Tags ersetzt

_________________
Solange die Bombe tickt ist alles in Ordnung, erst wenn sie damit aufhört wird es problematisch...
yukon-troll
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 60



BeitragVerfasst: Do 22.05.03 20:03 
Hi,

normalerweise mache ich das immer so
(zumindestens unter Interbase/Firebird)

ausblenden Delphi-Quelltext
1:
2:
3:
4:
Bed1 := QuotedStr(AnsiUpperCase('%' + Edit1.Text + '%'));

sqlstring :=   'Select * From Lieder.db ' + 
               'where UPPER(Titel) LIKE ' + Bed1 + ...


MfG Wim


Moderiert von user profile icontommie-lie: Code- durch Delphi-Tags ersetzt
Andi1982 Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 497

WinXP HE
D6 Enterprise
BeitragVerfasst: Do 22.05.03 20:08 
@yukon-troll: Dann sucht er aber mit "SHADOW" und findet nichts weils in der Table so steht "Shadow".

Versteht ihr mein Problem?

_________________
Solange die Bombe tickt ist alles in Ordnung, erst wenn sie damit aufhört wird es problematisch...
yukon-troll
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 60



BeitragVerfasst: Do 22.05.03 20:14 
in Edit1 steht z.B. -> ShaDOw
mit QuotedStr(AnsiUpperCase('%' + Edit1.Text + '%')) wird daraus -> "%SHADOW%"
in derDatenbank steht zwar -> Shadow
aber mit UPPER(Titel) wird dabei auf -> SHADOW verglichen !

Mfg yukon-troll


Zuletzt bearbeitet von yukon-troll am Do 22.05.03 20:46, insgesamt 1-mal bearbeitet
Andi1982 Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 497

WinXP HE
D6 Enterprise
BeitragVerfasst: Do 22.05.03 20:17 
Oh Danke!!!!

Das ist das was ich gesucht habe! Habs nur nicht gesehen am Anfang!! Vielen Dank!!!

_________________
Solange die Bombe tickt ist alles in Ordnung, erst wenn sie damit aufhört wird es problematisch...