Autor Beitrag
D. Annies
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: Di 16.11.04 21:02 
Liebe Helpher,

wie muss der Code verändert werden, damit die zweite query nur durchgeführt wird, wenn es mehr als Null Bücher sind, die freigegeben werden sollen?
Eventuell mit showmessage('Nichts zu tun!');

Code:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
procedure TForm1.buecherfreigabeclick(Sender: TObject);             // Bücher-frei-gabe
begin  
  screen.cursor := crhourglass;  dbgrid5.visible := false;
  with QBuecher do
  begin
    Close; SQL.Clear;
    SQL.Text := 'select count(*) from buecher ' +
                'where A_DATUM is not NULL and R_DATUM is not NULL ;';
    OPEN;
    showmessage(format('Freigabe von %s Buch/Büchern erfolgt jetzt', [fields[0].asstring]));
  end;

  with QBuecher do
  begin
    close; SQL.Clear;
    SQL.Text := 'update buecher ' +
       'set HDZKLA = '''', KLASSE = '''', A_DATUM = NULL, R_DATUM = NULL, NAME = '''',  
              VORNAME = '
''' ' +
       'where A_DATUM is not NULL and R_DATUM is not NULL ;';
    ExecSQL;
  end;


Danke, Detlef Annies

Moderiert von user profile iconUGrohne: Delphi-Tags hinzugefügt.
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Di 16.11.04 21:10 
mit ner Anfrage?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
 // 1. Abfrage
if QBuecher.fields[0].asinteger > 0 then
 // 2. Abfrage
else
 messagebox(0, 'Nichts zu tun!', 'Hinweis', MB_OK or MB_ICONINFORMATION);



mfg
GSE

PS: Pack deinen Code doch das nächste mal bitte in Delphi-Tags, das erleichtert das Lesen umgemein.

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: Sa 20.11.04 10:38 
Hi, GSE,

klappte so leider nicht habe aber mitlerweile eine Lösung!

Danke, D. Annies
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Sa 20.11.04 11:19 
Zitat:
habe aber mitlerweile eine Lösung
könntest du die mal kundtun, denn eigentlich sollte mein Vorschlag funktionieren (vorausgesetzt ich hab alles richtig verstanden)?

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: Sa 20.11.04 20:45 
Hi, GSE,

hier der Code (ich hoffe, ich habe die Delphi-Tags richtig gesetzt!(?) (Anmerkung vom Mod: Nein, hast Du nicht, verwende am besten die Buttons oben ;-))

Grüße, Detlef Annies

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
QBuecher.first; n := 0;
  while not QBuecher.eof do
  begin
    if (QBuecher.fieldbyname('A_DATUM').asstring <> '') and
       (QBuecher.fieldbyname('R_DATUM').asstring <> '') then inc(n);
    QBuecher.next;
  end;
  if n > 0 then
  with QBuecher do
  begin
    close; SQL.Clear;
    SQL.Text := 'update buecher ' +
       'set HDZKLA = '''', KLASSE = '''', A_DATUM = NULL, R_DATUM = NULL, NAME = '''', VORNAME = '''' ' +
       'where A_DATUM is not NULL and R_DATUM is not NULL ;';
    ExecSQL;
    TbBuecher.refresh;  q1sort(self);
  end;
  QBuecher.first; dbgrid5.visible := true;
  showmessage(inttostr(n) + ' Bücher wurden freigegeben!');
  screen.cursor := crdefault; button24click(self); button11.setfocus


Moderiert von user profile iconUGrohne: Delphi-Tags hinzugefügt.
D. Annies Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1843

windows 7
D6 Enterprise, D7 Pers und TD 2006
BeitragVerfasst: So 28.11.04 19:05 
Hi, Ulf (oder so..)

ist es richtig, dass ich, um Delphi-Code richtig zu setzen, /Delphi setzen muss, was muss ich am Schluss setzen? (Habe es vergessen, sorry)

Gruß, D. Annies
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: So 28.11.04 19:24 
Nein, Du setzt einfach [delphi] und [/delphi] um Deinen Quelltext, dann wird er so schön hervorgehoben. Alternativ kannst Du aber auch den entsprechenden Style-Button oben verwenden.