关于修改记录问题?
初学着请教
我修改记录 能修改 问题在修改某个记录以后 数据库中的所有数据都修改拉 怎么回事
procedure Txg.Button1Click(Sender: TObject);
var name,sql1:string;
begin
name:=edit1.Text;
sql1:='select * from aa where name='+''''+name+'''';
adodataset1.Active:=false;
adodataset1.CommandText:=sql1;
adodataset1.Active:=true;
if(adodataset1.FieldValues['name']<>null) then
begin
edit2.Text:=adodataset1.FieldValues['sex'];
edit3.Text:=adodataset1.FieldValues['age'];
end
else
begin
showmessage('该记录不存在!');
end
end;
procedure Txg.Button2Click(Sender: TObject);
var sex,age,sql1:string;
begin
sex:=edit2.Text;
age:=edit3.Text;
sql1:='update aa set sex='+''''+sex+''',age='+''''+age+'''';
xscjdm.xscjADOCommand.CommandText:=sql1;
xscjdm.xscjADOCommand.Execute;
showmessage('修改成功!');
end;