Autor Beitrag
NTM
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 120

Win XP
2005 Prof
BeitragVerfasst: Di 05.12.06 20:37 
Hallo zusammen,
ich habe mal wieder ein kleines Problem mit einem SQL Löschbefehl
wenn ich folgenden Befehl eingebe delete * from RechnungsDaten
und diesen folgender Maße aufrufe

DataModule1.ADOQuery1.SQL:= Memo1.Lines;
DataModule1.ADOQuery1.Active := True;

bekomme ich erstens die Meldung
ADOQuery1: CommandText gibt keine Ergebnismenge zurück und zweitens kappt er mir sofort die komplette Verbindung zur Datenbank.

Ich bedanke mich schon einmal für eure Tip´s
Robert.Wachtel
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 895
Erhaltene Danke: 7

Windows 7 Ultimate x64
D5 Ent, D7 Arch, RAD Studio 2010 Pro, VS 2008
BeitragVerfasst: Di 05.12.06 20:53 
Deine Abfrage gibt keine Ergebnismenge zurück, darf also nur mit Execute (oder wars ExecSQL?) ausgeführt werden.
NTM Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 120

Win XP
2005 Prof
BeitragVerfasst: Di 05.12.06 20:55 
Danke das habe ich auch schon gemacht egal ob ich denn Befehl davor oder danach schreibe der Fehler besteht dann immer noch.
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Di 05.12.06 21:35 
ausblenden Delphi-Quelltext
1:
AdoDataset.Active := True					

Öffnet die Datenmenge und erwartet in irgend einer Form eine Tabelle (Datenmenge), selbst eine Leere.

Ich postuliere, das Du ein 'DELETE' als SQL-Befehl absetzen willst. Da kommt keine Ergebnismenge zurück. Punkt.

Also klappt das 'Active := True' nicht. 'Open' auch nicht, denn das ist das Gleiche.

Um einen DML-Befehl auszuführen, verwende 'ExecSQL', oder ein TADOCommand, oder die 'Execute'-Methode der TADOConnect.

_________________
Na denn, dann. Bis dann, denn.
Blawen
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: Di 05.12.06 21:43 
Statt
user profile iconNTM hat folgendes geschrieben:
delete * from RechnungsDaten
würde ich "truncate table" vorziehen.

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)
alzaimar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2889
Erhaltene Danke: 13

W2000, XP
D6E, BDS2006A, DevExpress
BeitragVerfasst: Di 05.12.06 22:35 
Das löst das Problem zwar nicht, aber besser ist es. Viel besser sogar.

_________________
Na denn, dann. Bis dann, denn.