Autor Beitrag
Hans-Georg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Mo 20.09.10 10:51 
Hallo
Ich möchte in einer Tabelle nach
einen bestimmten Datensatz suchen
und habe das so gemacht aber ich bekomme die fehlermeldung

"EOLE Exeption Parameter hat keinen Standartwert"

was ist da falsch oder vergessen worden.


procedure TForm1.PersonalNameSuche(Sender: TObject);
var
SearchVal : String;
begin
s := '';
SearchVal := '';
s := InputBox('Datensatz Suchen','Suchbegriff','');
SearchVal := s;
//SQL---------------------------------------------------------------------------
DataModule1.ADOAbfrageQuery1.Close;
DataModule1.ADOAbfrageQuery1.SQL.Clear;
//Aus den Internet
DataModule1.ADOAbfrageQuery1.SQL.Add('select * from Personal where name like ''%'+SearchVal+'%''');
DataModule1.ADOAbfrageQuery1.open;
DataModule1.ADOAbfrageQuery1.ExecSQL; //??
end;[/delphi]

danke im vorraus
Hans-Georg


Zuletzt bearbeitet von Hans-Georg am Di 21.09.10 14:34, insgesamt 1-mal bearbeitet
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mo 20.09.10 10:58 
Es fehlt das Like:

ausblenden SQL-Anweisung
1:
select * from Personal where name like '%<Text>%';					

_________________
Markus Kinzler.
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Mo 20.09.10 16:21 
Und es sind eventuell die falschen Anführungszeichen. Nach SQL sind da '' ran, nicht ""; aber je nach nach DBMS wird das mehr oder weniger strikt gehandhabt.

OT: beim ersten Absatz hab ich jetzt echt überlegt, ob das ein bestimmtes Versmaß darstellen soll. Für einen Dactylus ists aber je eine Silbe zu viel :P

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Mo 20.09.10 16:27 
Zitat:
Nach SQL sind da '' ran, nicht ""; aber je nach nach DBMS wird das mehr oder weniger strikt gehandhabt.
Oder hat eine andere Bedeutung

_________________
Markus Kinzler.
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Mo 20.09.10 16:34 
Hat es eigentlich immer, aber manche DBMS raten da dann was gemeint sein könnte.

Also: Single-Quotes nehmen, das klappt immer.

ausblenden Delphi-Quelltext
1:
 DataModule1.ADOAbfrageQuery1.SQL.Add('select * from Personal where name like ''%'+SearchVal+'%''');					

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."