Autor Beitrag
PhilSMA
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Sa 25.02.06 12:47 
Hallo zusammen,
ich habe schon im Forum gesucht, aber leider noch nicht das richtige gefunden.

Folgendes Problem:
Ich rufe in meinem Programm eine StoredProcedure auf, hier ein Ausschnitt aus dem Aufruf:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
if(DateToStr(TimePick_Abschluss_von.Date)='01.01.1900') then
         ParamByName('@abschldatumvon').AsDate := NULL
      else
         ParamByName('@abschldatumvon').AsDate  :=TimePick_Abschluss_von.Date;
      if(DateToStr(TimePick_Abschluss_bis.Date)='01.01.1900') then
         ParamByName('@abschldatumbis').AsDate  := NULL
      else
         ParamByName('@abschldatumbis').AsDate  :=TimePick_Abschluss_bis.Date;


Das funktioniert aber so nicht, weil ich NULL wohl nicht einfach so übergeben kann.
Was kann ich z.B. für "ParamByName('@abschldatumvon').AsDate := NULL" anders schreiben, damit ich
dem Parameter @abschldatumvon einfach "nix" (NULL) zuweise?
Ich hoffe ihr könnt mir helfen, weiß im Moment nicht so richtig weiter...

Viele Grüße aus Kassel,
Phil
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Sa 25.02.06 13:34 
Wie wär's mit nil ;)

AXMD
PhilSMA Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Sa 25.02.06 13:46 
wenn ich statt

ausblenden Delphi-Quelltext
1:
ParamByName('@abschlussdatum_von').AsDate      := NULL					


nun

ausblenden Delphi-Quelltext
1:
ParamByName('@abschlussdatum_von').AsDate      := nil					


verwende, kommt die Fehlermeldung

"Inkompatible Typen: "string" und "pointer" "

was mache ich falsch?
Blawen
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: Sa 25.02.06 15:08 
und wenn Du einfach
ausblenden Delphi-Quelltext
1:
ParamByName('@abschlussdatum_von').AsDate      := ''					

übergibst?
oder den Parameter gleich weglässt?
ausblenden Delphi-Quelltext
1:
2:
  if(DateToStr(TimePick_Abschluss_bis.Date)<>'01.01.1900') 
then ParamByName('@abschldatumbis').AsDate  :=TimePick_Abschluss_bis.Date;

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)
PhilSMA Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Di 28.02.06 09:44 
Hallo "Blawen",
hehe, auf die Idee den Parameter einfach wegzulassen hätte ich ja auch mal kommen können. Dankeschön für den Hinweis,
jetzt gehts! ;-)

Viele Grüße aus Kassel,
PhilSMA
alex517
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 60


D7Ent, FB, FIBPlus
BeitragVerfasst: Di 28.02.06 10:37 
Hi,

nur Parameter weglassen könnte beim wiederholten Aufruf schiefgehen, wenn
der Parameter noch vom vorhergehenden Aufruf gesetzt ist.
Besser ist:
ausblenden Delphi-Quelltext
1:
.ParamByName('XYZ').Clear;