Autor Beitrag
enigma
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 18



BeitragVerfasst: Mi 30.10.02 20:40 
Ich verwende eine SQLQuery-Komponente um auf eine Datenbank zuzugreifen

ausblenden Quelltext
1:
2:
3:
SQLQuery.SQL.Add('SELECT * FROM tabelle');
SQLQuery.Open;
SQLQuery.First;


Zur laufzeit bekomme ich dann den Fehler: Cursor not reseted.
Wie kann ich den Cursor reseten?

(Vorher führe ich eine SQL-Anweisungen mit ExecSQL aus)
LCS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Do 31.10.02 08:06 
Hi
an dem Code ist erst mal nix auszusetzen. Poste doch mal welche DB du verwendest und welche SQL Anweisung du vorher ausführst.

Gruss Lothar

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...
enigma Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 18



BeitragVerfasst: Do 31.10.02 08:10 
Benutze MS SQL-Server 2000.

Vorher mach ich ein paar Insert und Delete Anweisungen die ich mit
ExecSQL ausführe
GuGl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 35



BeitragVerfasst: Do 31.10.02 11:18 
Hi enigma,

wird die query vorher geschlossen, und SQL.TEXT mit CLEAR
auf '' gesetzt ?

_________________
Gruß, GuGl
enigma Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 18



BeitragVerfasst: Do 31.10.02 13:21 
also SQL.Clear mach ich nicht (ich dachte das geht automatisch)
und muss man auch nach ExecSQL die SQLQuery wieder Closen??
GuGl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 35



BeitragVerfasst: Do 31.10.02 13:53 
Nach execsql muß man nicht closen, da keine Ergebnismenge
vorhanden ist.

Wenn du mit dem SQL.ADD(...) arbeitest, solltest du immer vorher
den clear machen, oder direkt den SQL.TEXT := '...' benutzen.

Ich habe mir das so angewöhnt:


ausblenden Quelltext
1:
2:
3:
4:
5:
with query1 do begin
     close;
     sql.text := '.....';
     open;  // oder execsql
end;


das klappt auf jeden Fall

_________________
Gruß, GuGl
enigma Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 18



BeitragVerfasst: Do 31.10.02 15:33 
danke hat gefunzt

nächstes problem:

Wenn ich ne SQLQuery auf eine Tabelle verwendet hab, und danach wieder für eine andere Tabelle benutzen will, findet der bei FieldValues keine Spalten der neuen Tabelle.

Wie grieg ich das hin??