请多指教~~
procedure TForm1.Button1Click(Sender: TObject);
begin
if(trim(edit1.Text)<>'') and (trim(edit2.Text)<>'') and (trim(edit3.Text)<>'') then
begin
with form1.table1 do
begin
first;
while not eof do
begin
if(edit3.Text=fieldbyname('账号').AsString) then
showmessage('该账号已经存在!')
else
begin
edit;
append;
fieldbyname('账号').AsString:=edit3.Text;
fieldbyname('姓名').AsString:=edit1.Text;
fieldbyname('密码').AsString:=edit2.Text;
post;
Refresh;
showmessage('注册成功!');
break;
end;
end;
end;
ss:=form1.Table1.FieldByName('学号').AsString;
form3.Table1.Edit;
form3.Table1.FieldByName('学号').AsString:=ss;
form3.table1.Post;
form4.Table1.Edit;
form4.Table1.FieldByName('学号').AsString:=ss;
form4.table1.Post;
form5.Table1.Edit;
form5.Table1.FieldByName('学号').asstring:=ss;
form5.table1.Post;
form6.Table1.Edit;
form6.Table1.FieldByName('学号').asstring:=ss;
form6.table1.Post;
end
else
showmessage('信息填写的不完整!');
edit3.Text:='';
edit1.Text:='';
edit2.Text:='';
end;