Autor Beitrag
Christoph Englmann
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 276



BeitragVerfasst: Di 03.08.04 18:35 
Hallo,

habe in einer Ereignisprozedur zwei Querys, welche ich auslesen will...

die erste wird noch einwandfrei ausgelesen, bei der zweiten allerdings gibt es die Fehlermeldung
"QueryTGL_GT: Operation bei geschlossener Datenmenge nicht ausführbar"..

Entweder ich seh den Wald (SChreibfehler vor lauter Bäumen net oder...)

hier der Quellcode:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
procedure TFormBT.cboTGL_2Change(Sender: TObject);
type TGuelt_Day = array[1..50] of string;

var
  i :integer;
  Guelt_Day :TGuelt_Day;

begin
//Query Tageslisten
  QueryTGL.Params.ParamByName('vSTAENDE_ID').AsString := vSTAENDE_ID;
  QueryTGL.Params.ParamByName('vTGL_NR').AsString := cboTGL_2.text;
  QueryTGL.Active := true;
  formBT.Action;

//Schreiben der Abfrageergebnisse in die listview Tagesliste
if QueryTGL.RecordCount > 0 then
begin
  QueryTGL.First;
  repeat
    FormBT.lstviewTGL.Items.Add;
    i := FormBt.lstviewTGL.items.count -1;
    FormBT.lstviewTGL.Items[i].Caption := QueryTGL.fieldByName('TGL_NR').AsString;
    FormBT.lstviewTGL.Items[i].SubItems.add  (QueryTGL.fieldByName('GUELT_VON').AsString);
    FormBT.lstviewTGL.Items[i].SubItems.add (QueryTGL.fieldByName('PRG_NR').AsString);
    FormBT.lstviewTGL.Items[i].SubItems.add (QueryTGL.fieldByName('BT_FKT').AsString);
    FormBT.lstviewTGL.Items[i].SubItems.add ('Offset');
    FormBT.lstviewTGL.Items[i].SubItems.add (QueryTGL.fieldByName('SYNCH').AsString);
    FormBT.lstviewTGL.Items[i].SubItems.add (QueryTGL.fieldByName('BEMERKUNG').AsString);
    QueryTGL.Next;
  until QueryTGL.Eof;
    QueryTGL.close;
end;


//Query Gültigkeitstage
QueryTGL_GT.Params.ParamByName('vSTAENDE_ID').AsString := vStaende_ID;
QueryTGL_GT.Params.ParamByName('vTGL_NR').AsString := cboTGL_2.Text;
QueryTGL_GT.Active;

//Auslesen der Query Gültigkeitstage
i := 1;
//QueryTGL_GT.Open;
if QueryTGL_GT.RecordCount > 0 then
begin
QueryTGL_GT.First;
  repeat
  Guelt_Day[i] := QueryTGL_GT.fieldbyname('GUELT_DAYS').AsString;
  i := i+1;
  QueryTGL_GT.Next;
  until QueryTGL_GT.Eof;
end;


end;


danke für jeden Hinweis...

christoph
grayfox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 800

win98, winXP
D4 Standard; D6 Personal
BeitragVerfasst: Di 03.08.04 19:08 
hallo christoph!

ausblenden Delphi-Quelltext
1:
2:
3:
  QueryTGL.Params.ParamByName('vSTAENDE_ID').AsString := vSTAENDE_ID;
  QueryTGL.Params.ParamByName('vTGL_NR').AsString := cboTGL_2.text;
  QueryTGL.Active := true;


du weist zwar deinem sqlstring werte zu und öffnest die query, aber zugehörigen sqlstring kann ich keinen finden. möglicherweise ist das der grund für deine fehlermeldung
deine ganzen routinen scheinen mir etwas ... undurchsichtig ;)

vielleicht wärs für dich von vorteil, wenn du dir im forum ein paar sql-beiträge ansiehst

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
if QueryTGL_GT.RecordCount > 0 then
begin
QueryTGL_GT.First;
  repeat
  Guelt_Day[i] := QueryTGL_GT.fieldbyname('GUELT_DAYS').AsString;
  i := i+1;
  QueryTGL_GT.Next;
  until QueryTGL_GT.Eof;
end;


verwende lieber  while not query.eof do....
du ersparst dir später vielleicht mal probleme.

mfg, stefan
löschi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 44



BeitragVerfasst: Di 03.08.04 19:09 
du mußt die zweite query auch auf active:= true setzen
Christoph Englmann Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 276



BeitragVerfasst: Mi 04.08.04 09:14 
hallo löschi,

danke, genau das wars... wie gesagt vor lauter bäumen den wald net...
manchmal sollte man einfach aufhören und am nächste tag weitermachen...


hallo grayfox,

undurchsichtig... liegt vielleicht daran, dass ich erst ne woche delphi "programmiere" (bzw. versuche)...
bin aber auch der meinung, dass jeder seinen code so schreiben sollte, dass er für ihn durchsichtig ist... und funzen tut meiner auch (wenn ich :=true; hinter active schreibe... :-)


christoph