Autor Beitrag
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Sa 01.03.03 08:39 
Ich benutze die Zeoslibs, um mit meinem MySQL-Server zu kommunizieren. Ich kann auch einwandfrei eine neue Tabelle anlegen, dorthinein schreiben und auch updaten, aber wenn ich den Inhalt der Tabelle in einer ListView ausgeben will, bekomme ich einen EStackOverflow.

Das hier ist mein Quellcode für das schreiben in die ListView:
ausblenden volle Höhe 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:
31:
procedure TForm1.Btn_ZeigenClick(Sender: TObject);
var
  ListItem: TListItem;
begin
  dbMain.Host := Edt_Server.Text;
  dbMain.Login := Edt_User.Text;
  dbMain.Password := Edt_Passwort.Text;
  dbMain.Database := Edt_Datenbank.Text;
  dbMain.Connected := true;

  try
    qrMain.Sql.Text := 'SELECT * FROM `adressbuch` order by nachname;';
    qrMain.Open;

    qrMain.FieldByName('id').AsString;

    while not qrMain.Eof do
      begin
        ListItem := ListView1.Items.Add;
        ListItem.Caption := qrMain.FieldByName('id').AsString;
        ListItem.SubItems.Add(qrMain.FieldByName('vorname').AsString);
        ListItem.SubItems.Add(qrMain.FieldByName('nachname').AsString);
        ListItem.SubItems.Add(qrMain.FieldByName('adresse').AsString);
        ListItem.SubItems.Add(qrMain.FieldByName('plz').AsString);
        ListItem.SubItems.Add(qrMain.FieldByName('wohnort').AsString);
        qrMain.Next;
      end;
  finally
    dbMain.Connected := false;
  end;
end;


Kann mir jemand sagen, wo mein Fehler liegt?

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
bis11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1247
Erhaltene Danke: 2

Apple Mac OSX 10.11

BeitragVerfasst: Sa 01.03.03 11:55 
In welcher Zeile kommt denn der Fehler ?
derDoc Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Sa 01.03.03 15:20 
Der Fehler tritt zur Laufzeit auf, wenn ich auf den Button klicke. Delphi springt dann wie üblich in den Quelltexteditor zurück und zeigt mir den Quellcode der Query an. Es wird die Zeile
ausblenden Quelltext
1:
if not Query.Active then					

markiert.
Wenn ich nun F9 drücke geht er zurück zum Programm und das CPU Fenster öffnet sich. Dort sind dann wieder ein paar Einträge markiert. Von diesem Punkt an komme ich nur noch mit STRG + F2 zurück zu Delphi.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
bis11
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1247
Erhaltene Danke: 2

Apple Mac OSX 10.11

BeitragVerfasst: Sa 01.03.03 16:30 
Ah, jetzt geht mir ein Lichtlein auf :think:

Setze doch mal die folgende Zeile vor die WHILE-Schleife :
ausblenden Quelltext
1:
qrMain.Active := true;					


und diese Zeile hinter die WHILE-Schleife :
ausblenden Quelltext
1:
qrMain.Active := false;					
derDoc Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Sa 01.03.03 16:43 
Es kommt immer noch der Fehler:

Zitat:
Zugriffsverletzung bei 0x0040cc85: Schreiben von Adresse 0x00030f2c.

Und in Delphi EStackOverflow.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.