AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Datenbanken FB: Prepared Query mit In-Statement ?
Thema durchsuchen
Ansicht
Themen-Optionen

FB: Prepared Query mit In-Statement ?

Ein Thema von hoika · begonnen am 30. Dez 2017 · letzter Beitrag vom 11. Jan 2018
 
Delphi.Narium

Registriert seit: 27. Nov 2017
2.558 Beiträge
 
Delphi 7 Professional
 
#5

AW: FB: Prepared Query mit In-Statement ?

  Alt 30. Dez 2017, 16:53
Jain, so absolut stimmt das nicht.

Je Parameter darf nur ein Wert übergeben werden.

Dashier funktioniert:
Delphi-Quellcode:
  qry.Close;
  qry.SQL.Clear;
  qry.SQL.Add('select feld3 from tabelle where feld1 = :feld1 ');
  qry.SQL.Add('and feld2 in (:feld2) ');
  qry.Prepare;
  qry.Params[0].AsInteger := 1;
  qry.Params[1].AsString := '''Feldinhalt''';
  qry.Open;
  ShowMessage(Format('%d',[qry.RecordCount]));
  qry.Close;
Dashier funktioniert ebenfalls:
Delphi-Quellcode:
  qry.Close;
  qry.SQL.Clear;
  qry.SQL.Add('select feld3 from tabelle where feld1 = :feld1 ');
  qry.SQL.Add('and feld2 in (:feld2a,:feld2b,:feld2c) ');
  qry.Prepare;
  qry.Params[0].AsInteger := 1;
  qry.Params[1].AsString := '''FeldinhaltA''';
  qry.Params[2].AsString := '''FeldinhaltB''';
  qry.Params[3].AsString := '''FeldinhaltC''';
  qry.Open;
  ShowMessage(Format('%d',[qry.RecordCount]));
  qry.Close;
Dashier funktioniert jedoch nicht:
Delphi-Quellcode:
  qry.Close;
  qry.SQL.Clear;
  qry.SQL.Add('select feld3 from tabelle where feld1 = :feld1 ');
  qry.SQL.Add('and feld2 in (:feld2) ');
  qry.Prepare;
  qry.Params[0].AsInteger := 1;
  qry.Params[1].AsString := '''FeldinhaltA'',''FeldinhaltB'',''FeldinhaltC''';
  qry.Open;
  ShowMessage(Format('%d',[qry.RecordCount]));
  qry.Close;
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:27 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz