Autor Beitrag
Markos
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 67



BeitragVerfasst: So 16.10.05 12:14 
Hallo,

ich habe eine Access Datenbank in die ich in 2 Feldern das Datum eines DatePickers speichere

Anreise -> Felddatentyp TEXT
Abreise -> Felddatentyp TEXT

Bei der Select Abfrage scheint es mir so, als funktionieren die Abfragen nicht Jahresübergreifend, kann das hinkommen?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
with ADOQuery_Bplan do
begin
 SQL.Text:=
SELECT buchung.anreise, buchung.abreise, buchung.GID, buchung.anzahl_tage, buchung.vorgang,'+#13#10+   
'
WHERE (:datevon1 BETWEEN buchung.anreise AND buchung.abreise)';
    with Parameters do
    begin
      ParamValues['
datevon1'].Value    :=PlannerDatePicker15.Text;
    end;
end;


Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: So 16.10.05 12:34 
Wieso Texteigenschaft für Datumse?
Bist Du Dir sicher, das das Datumsformat korrekt von Access verstanden wird?

_________________
Na denn, dann. Bis dann, denn.
Markos Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 67



BeitragVerfasst: So 16.10.05 13:02 
@alzaimar

Wie soll ich die Felder sonst formatieren in der Access Datenbank und dann im Query auslesen?
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: So 16.10.05 13:13 
Na, äh.. Wie meinst du, "auslesen"?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
Query1.SQL.Text := 'Select myDateField from myAccessTable';
Query1.open;
Showmessage (Query1.FieldByName ('myDateField').DisplayText);
Showmessage (DateTimeToStr (Query1['myDateField']));

Oder meinst du, wie Du Access ein Datum übergeben kannst?
ausblenden Delphi-Quelltext
1:
2:
3:
Query1.SQL.Text := 'Select * from myAccessTable where myDateField >= :MyDate';
Query1.Parameters.ParamValues['myDateField'] := Now;
Query1.open;

Wenn du dein SELECT selbst zusammenbasteln willst (was ich nicht empfehle), dann musst Du, glaube ich, das Datum in '#' einklammern, also z.B. so:
ausblenden Delphi-Quelltext
1:
Query1.SQL.Text := 'Select * from myAccessTable where myDateField >= #2005-01-02#';					

Aber so genau weiss ich das nicht mehr.

_________________
Na denn, dann. Bis dann, denn.
Markos Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 67



BeitragVerfasst: So 16.10.05 13:59 
@alzaimar

Soll ich das Feld in der Accessdatenbank dann anstatt Text mit Felddatentyp "Datum/Uhrzeit" formatieren und als Format "Datum,kurz" ?