Autor Beitrag
EEK
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 40

WIN XP
Delphi 5 Pro., Turbo Delphi 2006, C#, C++
BeitragVerfasst: Mi 11.10.06 13:34 
Hallo,

ich greife mit meinem Programm über ADO auf eine Access Datenbank zu. Wenn ich neue Daten in die die Tabelle schreibe, dann werden die neuen Daten erst nach Neustart des Programms in der DBGrid angezeigt, ich möchte aber dass die Daten sofort in der DBGrid angezeigt bekommen. Ich hab mal mit Delphi 6 Pro. ein Ähnliches Programm geschrieben, und damals funktioniert es mit
ausblenden Delphi-Quelltext
1:
2:
3:
4:
      ADOQuery1.SQL.Clear();
      ADOQuery1.Close();
      ADOQuery1.SQL.Add('SELECT * FROM Erfassung');
      ADOQuery1.Open();


Ich programmiere jetzt mit Turbo Delphi 2006 und da funktioniert es so nicht. Ich bekomme zwar keine Fehlermeldung, aber die neuen Daten werden wie vorher erst nach Neustart des Programms angezeigt. Hab’s auch schon mit "Refresh" versucht, aber das funktioniert ebenfalls nicht. Hier im Forum hab ich zwar einige gefunden, die dasselbe Problem hatten, aber die Lösungen haben mir nicht wirklich geholfen. Vielleicht weiß ja einer von Euch woran es liegen könnte.
uwewo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 154



BeitragVerfasst: Mi 11.10.06 13:53 
Versuchs mal mit Refresh
EEK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 40

WIN XP
Delphi 5 Pro., Turbo Delphi 2006, C#, C++
BeitragVerfasst: Mi 11.10.06 13:54 
Hab ich schon, hat leider auch nicht funktioniert.
NTM
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 120

Win XP
2005 Prof
BeitragVerfasst: Mi 11.10.06 15:46 
Wie lautet denn der speicher Befehl. In anderen Wort wie gehst du vor.
EEK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 40

WIN XP
Delphi 5 Pro., Turbo Delphi 2006, C#, C++
BeitragVerfasst: Mi 11.10.06 15:58 
Ich schätze mal das du mit speicher Befehl meinst wie ich in die Datenbank schreibe.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
ADOQuery1.SQL.Add('INSERT INTO Erfassung ([Linie], [Datum], [Sap Nummer], [Projekt], [Kunde], [Auftrag Nr], [Stückzahl], [B/L-Seite], [Name], [Personal Nr], [Tätigkeit], [Uhrzeit])');
ADOQuery1.SQL.Add('Values ('+Linie +','+ Datum +','+ SapNummer+','+ Projekt +','+ Kunde+','+ Auftragsnummer +','+ Stueckzahl +','+ Seite +','+ Name +','+ PersonalNr+','+ Taetigkeit+','+ Uhrzeit+')');
ADOQuery1.Close();
ADOQuery1.ExecSQL;


und anschließend ruf ich die Prozedur "AlleDatenAnzeigen();" auf, in der dann das
ausblenden Delphi-Quelltext
1:
2:
3:
4:
ADOQuery1.SQL.Clear();  
ADOQuery1.Close();  
ADOQuery1.SQL.Add('SELECT * FROM Erfassung');  
ADOQuery1.Open();

steht.
NTM
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 120

Win XP
2005 Prof
BeitragVerfasst: Mi 11.10.06 16:04 
hast du es schon mit dem Befehl edit versucht anstatt dem Kompletten SQL Befehl.
EEK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 40

WIN XP
Delphi 5 Pro., Turbo Delphi 2006, C#, C++
BeitragVerfasst: Mi 11.10.06 16:15 
Also vorausgesetzt ich habe den edit Befehl jetzt richtig verwendet, da ich ihn noch nicht kannte
ausblenden Delphi-Quelltext
1:
ADOQuery1.Edit;					

funktioniert es nicht, bzw. das Programm bricht mit einer Fehlermeldung ab: "'ADOQuery1: Eigenschaft SQL fehlt"
NTM
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 120

Win XP
2005 Prof
BeitragVerfasst: Mi 11.10.06 16:17 
Du hast deinen ADOQuery (Komponente) noch keinen SQl Befehl mitgeteil das heißt du gibts z.B. Select*from.. ein
EEK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 40

WIN XP
Delphi 5 Pro., Turbo Delphi 2006, C#, C++
BeitragVerfasst: Mi 11.10.06 16:25 
Ich hab mir schon sowas gedacht, die frage ist nur wo ich den eingebe? Bei den anderen Komponenten steht im "Objektinspektor" immer was von CommandText wo ich den SQL Befehl eingebe. Nur bei der ADOQuery finde ich sowas nicht.
NTM
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 120

Win XP
2005 Prof
BeitragVerfasst: Mi 11.10.06 16:31 
Im Ojektinspektor ist schon richtig es muß ziemlich weit unten sein.Genau kann ich es dir erst heute Abend oder morgen früh sagen da ich dann wieder an meinen Rechner sitze. Ich hoffe das reicht aus.
EEK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 40

WIN XP
Delphi 5 Pro., Turbo Delphi 2006, C#, C++
BeitragVerfasst: Mi 11.10.06 17:29 
Klar morgen reicht völlig. Kann es sowieso erst morgen früh wenn ich wieder in der Arbeit bin ausprobieren. Vielen dank schonmal.
NTM
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 120

Win XP
2005 Prof
BeitragVerfasst: Mi 11.10.06 19:06 
Klicke auf dein ADOQuery gehe dann in dein Objektinpektor scrolle nach unten dort findest du denn Punkt SOL klicke auf die drei Punkt und gebe ein Select* from (name deiner Datenbank).
EEK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 40

WIN XP
Delphi 5 Pro., Turbo Delphi 2006, C#, C++
BeitragVerfasst: Do 12.10.06 07:31 
Nochmals danke für die Hilfe, aber das war es wohl nicht. Den Punkt SQL hab ich gefunden, aber da hatte ich das SELECT * FROM... schon eingegeben.
uwewo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 154



BeitragVerfasst: Do 12.10.06 08:13 
Benutze doch mal anstelle von TQuery -> TTable damit funktioniert es doch auch, oder?
NTM
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 120

Win XP
2005 Prof
BeitragVerfasst: Do 12.10.06 08:50 
Welches Tabel benutzt du denn?.
Das normale vorgehen wäre du hast eine oder mehere ADOQuery wo du auf deine Datenbank drauf zu greifen kannst.
Wenn die Verbindung steht hast du z.B. ein paar DBEdit Felder wo der User etwas eingeben soll und einen Button wie z.B. Speichern und zur übersicht noch ein DBTabel.
Bei dem Button gibts du einen onklick und gibts dort ein ADOQuery1.Edit; ein und das wars.
Ich hoffe ich habe nichts vergessen
EEK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 40

WIN XP
Delphi 5 Pro., Turbo Delphi 2006, C#, C++
BeitragVerfasst: Do 12.10.06 09:53 
Ich erkläre es mal ein bisschen genauer, vielleicht nützte es ja was. Die Firma in der ich arbeite bestückt Leiterplatten wie z.B. Mainboards. Jedenfalls wird das Automatisch von so genanten „Linien“ gemacht. Ich musste jetzt ein Programm dafür schreiben damit kontrolliert werden kann, warum die Linien wie lange ausgefallen sind. Die Bediener an den Linien können per Buttons auswählen warum die Linie ausgefallen bzw. nicht „im Einsatz“ war (Ich lade mal einen Screenshot hoch, vielleicht wird es dann verständlicher). Die Daten werden in eine Access Datenbank geschrieben, und sollen wenn die Bediener einen Button gedrückt haben, auch sofort im Programm angezeigt werden. Das schreiben in die Datenbank funktioniert, allerdings werden die neuen Daten wie gesagt erst nach Neustart des Programms angezeigt. Dafür habe ich eine ADOQuery für den zugriff auf die Datenbank angelegt, und in einer DBGrid werden oder sollen immer die „Alten“ Daten angezeigt werden und wenn Neue Fehler auftreten soll die DBGrid aktualisiert werden. Wie gesagt das lesen und schreiben in die Datenbank funktioniert, nur die Aktualisierung der DBGrid nicht.
Einloggen, um Attachments anzusehen!
EEK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 40

WIN XP
Delphi 5 Pro., Turbo Delphi 2006, C#, C++
BeitragVerfasst: Do 12.10.06 10:01 
Wenn ich wie du gesagt hast beim OnClick des Buttons ADOQuery1.Edit schreibe, dann bricht mir das Programm mit der Fehlermeldung „Der aktuelle Provider unterstützt nicht die Wiedergabe mehrfacher Recordsets bei einer einzelnen Ausführung“ ab.
NTM
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 120

Win XP
2005 Prof
BeitragVerfasst: Do 12.10.06 10:13 
Kannst du mal das Programm schicken damit ich mir das mal zu Hause angucken kann wo der fehler ist.
Falls du willst.
EEK Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 40

WIN XP
Delphi 5 Pro., Turbo Delphi 2006, C#, C++
BeitragVerfasst: Do 12.10.06 10:18 
Danke ist echt nett von dir das du dir das Programm selber ansehen würdest, aber wenn mein Chef raus bekommt das ich dir das Programm oder den Quellcode geschickt habe, dann bekomme ich Ärger. Naja ich werde es schon irgendwie hin bekommen. Danke nochmal an alle die geholfen haben.
uwewo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 154



BeitragVerfasst: Do 12.10.06 10:23 
Werden die Daten nur auf einem PC eingegeben und gelesen? Oder liegt das ganze im Netz?

Zum anderen IMHO wird TQuery nicht automatisch aktualisiert, TTable schon.
Allerdings auch nur auf dem Rechner wo die Daten eingegeben werden!!!