with DataModule2.ADOQuery1 do
begin
close;
sql.Add('select * from users where name = :n and password = :p');
open;
if FieldByName('n').AsString = edit5.Text then
begin
if FieldByName('p').AsString = edit6.Text then
begin
if edit7.Text = edit8.Text then
begin
edit;
FieldByName('password').AsString := edit8.Text;
Post;
showmessage('密码修改成功!');
end else showmessage('两次新密码不一直');
end else showmessage('旧密码错误')
end else showmessage('账号错误');
end;
哪里出错了???
你的指针没有向下移,当然一直偶读是修改第一条记录了,应该这样ADOTable1.next,来下移指针,这样就可以修改下一条了。
DataModule2.ADOQuery1.close; //
DataModule2.ADOQuery1.sql.clear;
DataModule2.ADOQuery1.sql.Add('select * from users where name = :n and password = :p');//
DataModule2.ADOQuery1.Parameters.ParamByName('n').Value := edit5.Text;//
DataModule2.ADOQuery1.Parameters.ParamByName('p').Value := edit6.Text;//
DataModule2.ADOQuery1.open;//
with ADOQuery1 do
begin
close;
sql.Add('select * from users where name = :n and password = :p');
open;
//if FieldByName('n').AsString = edit5.Text then
if Parameters.ParamByName('n').value = edit5.Text then
begin
//if FieldByName('p').AsString = edit6.Text then
if Parameters.ParamByName('p').value = edit6.Text then
begin
if edit7.Text = edit8.Text then
begin
edit;
FieldByName('password').AsString := edit8.Text;
Post;
showmessage('密码修改成功!');
end else showmessage('两次新密码不一直');
end else showmessage('旧密码错误')
end else showmessage('账号错误');
end;
请注意此处你写错了
//if FieldByName('n').AsString = edit5.Text then
if Parameters.ParamByName('n').value = edit5.Text then
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息