Hi, Delpher,
ich will eine Geburtstagsabfrage über zwei Tabellen machen. Die Ergebnisse sollen in einem Stringgrid untereinander erscheinen.
Dazwischen soll eine Leerzeile stehen.
Etwas code habe ich schon:
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: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70:
| procedure TBuchMain.GebTagAlle(sender:Tobject); var tbname : string; qx : TQuery; r, c, k, nk : integer; begin for r := 1 to tntstringgrid1.rowcount-1 do for c := 1 to tntstringgrid1.ColCount-1 do tntstringgrid1.cells[c,r] := ''; tntstringgrid1.ColCount := 4;
qx := TQuery.create(Application); qx.datasource := qSchueler.DataSource; tbname := TbSchueler.TableName;
qx.Close; if qx.FindField('gebdat') <> NIL then qx.SQL.Text := format('select Name, Vorname, Klasse from "%s" ', [TbName]); qx.Open; tntstringgrid1.RowCount := qx.recordcount+1; tntstringgrid1.RowHeights[0] := 20; tntstringgrid1.cells[0,0] := 'Nr'; qx.First; k := 0; while not qx.eof do begin with tntstringgrid1 do begin inc(k); cells[0,k] := inttostr(k); for nk := 1 to qx.FieldCount do cells[nk,k] := qx.Fields[nk-1].asstring; end; end; qx.next; end;
qx.datasource := qLk.DataSource; tbname := TbLk.Tablename; qx.Close; if qx.FindField('gebdat') <> NIL then qx.SQL.Text := format('select Name, Vorname, Klasse from "%s" ', [TbName]); qx.Open;
qx.First; k := 0; while not qx.eof do begin with tntstringgrid1 do begin inc(k); cells[0,k] := inttostr(k); for nk := 1 to qx.FieldCount do cells[nk,k] := qx.Fields[nk-1].asstring; end; end; qx.next; end;
end; |
Muss ich eine Query-Komponente auf das Formular legen?
Jetzt habe ich bei der Ausführung die Fehlermeldung:
"Keine SQL-Anweisung verfügbar"
Danke für Hilfe,
Detlef