Einzelnen Beitrag anzeigen

Benutzerbild von glunzl
glunzl

Registriert seit: 21. Mär 2004
Ort: Reinbek
119 Beiträge
 
Delphi 7 Professional
 
#6

Re: AdoQuery Parameterübergabe für SQL "IN" Operat

  Alt 23. Jul 2006, 17:08
Vielleicht weiß jemand eine anderen Rat ...

Delphi-Quellcode:
  // Abfrage der Checkboxen:
  if CB.Checked then GTypes := GTypes + '15,' ;
  if BK.Checked then GTypes := GTypes + '13,' ;
  if LK.Checked then GTypes := GTypes + '14,' ;
  if AGV.Checked then GTypes := GTypes + '1,'  ;
  if EAGV.Checked then GTypes := GTypes + '27,'  ;
  if FB.Checked then GTypes := GTypes + '16,' ;
  if TT.Checked then GTypes := GTypes + '11,' ;
  if Chassis.Checked then GTypes := GTypes + '14,' ;
  if Gabelstapler.Checked then GTypes := GTypes + '17,' ;
  if ReachStacker.Checked then GTypes := GTypes + '20,' ;
  if Saeulen.Checked then GTypes := GTypes + '21,' ;
  if ZM.Checked then GTypes := GTypes + '22,' ;
  if Smart.Checked then GTypes := GTypes + '23,' ;

  Query1.Active := false ;
  Query1.SQL.Clear ;
  Query1.ParamCheck := true ;

  Query1.SQL.Add( ...)

  // where Klausel, Parameter
  Query1.SQL.Add('WHERE ((tblGer.gerTyk) In (:GTypes)))') ;

  // letztes Komma entfernen
  GTypes := LeftStr(GTypes, length(GTypes)-1) ;

  // Parameter übergeben
  Query1.Parameters.ParamValues['GTypes'] := GTypes ;

  Query1.Active := true ;
Vielleicht hat jemand eine anderen Lösungsansatz ...

Michi
Michael
--
10 Jahre Step5 entschuldigen hoffentlich meinen Programmierstiel!
  Mit Zitat antworten Zitat