procedure TfrmPass.FormCreate(Sender: TObject);
begin
with ADOQuery1 do begin
Close;
SQL.Clear;
sql.Add('select 用户名 from 用户清单');
Open;
ComboBox1.Clear;
end;
while not adoquery1.Eof do
begin
comboBox1.Items.Add(adoquery1.fieldbyname('用户名').AsString);
adoquery1.Next;
end;end;procedure TfrmPass.Button1Click(Sender: TObject);
begin
with ADOQuery1 do begin
close;
SQL.Clear;
SQL.Add('Delect 密码 from 用户清单 where 用户名=ComBox1.Items');
SQL.Add('Insert into 用户清单 (密码) values (:temp)');
Parameters.ParamByName('temp').Value:=Trim(Edit3.Text);
Execsql;
close;
end;end;
就是上面的代码,在后面那一段程序中,不知道有什么错误,请大家帮忙看看
begin
with ADOQuery1 do begin
Close;
SQL.Clear;
sql.Add('select 用户名 from 用户清单');
Open;
ComboBox1.Clear;
end;
while not adoquery1.Eof do
begin
comboBox1.Items.Add(adoquery1.fieldbyname('用户名').AsString);
adoquery1.Next;
end;end;procedure TfrmPass.Button1Click(Sender: TObject);
begin
with ADOQuery1 do begin
close;
SQL.Clear;
SQL.Add('Delect 密码 from 用户清单 where 用户名=ComBox1.Items');
SQL.Add('Insert into 用户清单 (密码) values (:temp)');
Parameters.ParamByName('temp').Value:=Trim(Edit3.Text);
Execsql;
close;
end;end;
就是上面的代码,在后面那一段程序中,不知道有什么错误,请大家帮忙看看
这样写好像不对吧
试试这样写对不对
with ADOQuery1 do begin
close;
SQL.Clear;
SQL.Add('UPDATE 用户清单 SET 密码="'+Trim(Edit3.Text)+'" WHERE 用户名=ComBox1.Items');
Execsql;
close;
怎么回事呢???
SQL.Add('Delect 密码 from 用户清单 where 用户名='''+ComBox1.text+'''');
SQL.Add('Insert into 用户清单 (密码) values (:temp)');
Parameters.ParamByName('temp').Value:=Trim(Edit3.Text);