ok soweit geht das...aber jetzt kommt er mir mit inkompatiebele Typen, welches nicht sein kann, wenn ich auf Button6 klicke....
Delphi-Quellcode:
procedure TForm8.Button6Click(Sender: TObject);
var ver,s : string;
var mat,a : Integer;
procedure TForm8.Button2Click(Sender: TObject);
begin
zQuery3.First;
Label3.Caption := zQuery3.FieldbyName('VName').AsString;
Label5.Caption := zQuery3.FieldbyName('VNr').AsString;
end;
procedure TForm8.Button3Click(Sender: TObject);
begin
zQuery3.prior;
Label3.Caption := zQuery3.FieldbyName('VName').AsString;
Label5.Caption := zQuery3.FieldbyName('VNr').AsString;
end;
procedure TForm8.Button4Click(Sender: TObject);
begin
zQuery3.Next;
Label3.Caption := zQuery3.FieldbyName('VName').AsString;
Label5.Caption := zQuery3.FieldbyName('VNr').AsString;
end;
procedure TForm8.Button5Click(Sender: TObject);
begin
zQuery3.Last;
Label3.Caption := zQuery3.FieldbyName('VName').AsString;
Label5.Caption := zQuery3.FieldbyName('VNr').AsString;
end;
procedure TForm8.Button1Click(Sender: TObject);
var m,n,v,s : String;
var a,b,c : Integer;
begin
a:=1;
b:=1;
c:=1;
if edit1.text = '' then a :=1 else a := 0;
if edit2.text = '' then b := 1 else b := 0;
if edit3.text = '' then c := 1 else c := 0;
if (a = 0) and (b = 0) then showmessage('Bitte nur ein Suchkriterium nutzen!');
if (a = 0) and (c = 0) then showmessage('Bitte nur ein Suchkriterium nutzen!');
if (a = 0) and (b = 1) and (c = 1) then m := edit1.text
else
begin
n := '';
v := '';
end;
if (a = 1) and (b = 0) and (c = 0) then
begin
n := edit2.text;
v := edit3.Text;
end;
zquery1.SQL.Text := 'select * from Studenten WHERE (Matnr='+#39+m+#39+') or (Name='+#39+n+#39+' and Vorname='+#39+v+#39+')';
zquery1.open;
zQuery1.First;
end;
procedure TForm8.Button7Click(Sender: TObject);
begin
zQuery1.First;
end;
procedure TForm8.Button8Click(Sender: TObject);
begin
zQuery1.Prior;
end;
procedure TForm8.Button9Click(Sender: TObject);
begin
zQuery1.Next;
end;
procedure TForm8.Button10Click(Sender: TObject);
begin
zQuery1.Last;
end;
procedure TForm8.Button6Click(Sender: TObject);
var s : string;
var ver,mat,a : Integer;
begin
mat := zQuery1.Fieldbyname('Matnr').AsInteger;
ver := zQuery3.Fieldbyname('VNR').AsInteger;
zQuery2.SQL.Text := 'select * from studvera';
zquery2.open;
s := 'INSERT INTO studvera (Matnr1, vnr1) VALUES ('+#39+ mat +#39+','+#39+ a +#39+')';
zquery2.close;
zQuery2.Sql.Clear;
zQuery2.Sql.Add(s);
zQuery2.ExecSQL;
showmessage('Student erfolgreich eingetragen!');
Edit1.Text := '';
Edit2.Text := '';
Edit3.Text := '';
end;
procedure TForm8.Edit4Change(Sender: TObject);
var s : string;
begin
s:= 'select * from Veranstaltungen WHERE VName='+#39+Edit4.Text+#39+'';
zquery3.close;
zQuery3.Sql.Text := s;
zQuery3.Active:=true;
zQuery3.First;
end;
end.
Matnr1 = Integer
Vnr1 = Integer
Matnr = Integer
VNR = Integer
*Ich weiß Code etwas wirr aber eigentlich ging das so...*