Autor Beitrag
nooby
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 44

Win XP Pro.
D7
BeitragVerfasst: Mi 14.04.04 12:34 
Hallo, folgendes ist mein Problem:

Ich füge Daten in eine Access-DB ein und würde die aktualisierte Liste gerne in meinem DBGrid sehen. Das funktioniert aber nur im Entwurfsmodus wenn ich mich mit F8 durcharbeite. Sonst aktualisert er das DBGrid nicht. Wer weis einen Rat?

ausblenden 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:
      // log schreiben
          ADOQuery1.Active := False;
          ADOConnection1.Connected := False;

          strDataSource := 'Data source=' + ExtractFilePath(paramstr(0)) + 'history.mdb';
          ADOConnection1.ConnectionString := strprovider + strDataSource + ';Persist Security Info=False';
          ADOConnection1.Connected := True;

          ADOQuery1.Connection := ADOConnection1;
          ADOQuery1.SQL.Clear;
          strHeute := DateTimeToStr(Now);
          SQL := 'Insert into history (datum, kunde, Exceldatei, Inidatei, Accessdatei) VALUES 
              ("'
 + strHeute + '", "' + frmStart.ComboboxKunde.Text + '", "' + frmStart.lblExcelDatei.Caption 
              + '", "' + frmStart.lblInidatei.Caption + '", "' + strDatenbankname + '")';
          ADOQuery1.SQL.Add(SQL);
          intTest := ADOQuery1.ExecSQL;

      // DBGrid aktualisieren (anderes Formular)
          application.ProcessMessages;
          frmstart.ADOQuery1.Close;
          application.ProcessMessages;
          frmStart.ADOQuery1.SQL.Clear;
          application.ProcessMessages;
          frmstart.ADOQuery1.SQL.Text := 'Select * from history where kunde like "' + frmstart.ComboboxKunde.text + '%" order by datum desc';
          application.ProcessMessages;
          frmstart.ADOQuery1.Open;
          application.ProcessMessages;

      // Formular schließen
          self.Close;
MSCH
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1448
Erhaltene Danke: 3

W7 64
XE2, SQL, DevExpress, DevArt, Oracle, SQLServer
BeitragVerfasst: Mi 14.04.04 18:31 
Dein Query musst du natürlich auch aktualisieren. Requerry sollte helfen.
grez
msch

_________________
ist das politisch, wenn ich linksdrehenden Joghurt haben möchte?
nooby Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 44

Win XP Pro.
D7
BeitragVerfasst: Mi 14.04.04 21:41 
Nix anderes mache ich ja mit close und dann wieder open. Er zeigt den neuen Datensatz einfach nicht an. Habs auch mal mit Requery versucht, aber das Ergebnis ist das gleiche.
nooby Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 44

Win XP Pro.
D7
BeitragVerfasst: Mi 14.04.04 22:30 
Erledigt. Muste Refresh auf der Connection machen, da ich 2 verschiedene benutzt hab.