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;
就是上面的代码,在后面那一段程序中,不知道有什么错误,请大家帮忙看看

解决方案 »

  1.   

    用UPDATE和你这样操作又没有区别的。干吗不用UPDATE。
      

  2.   

    SQL.Add('Delect 密码 from 用户清单 where 用户名=ComBox1.Items');
    这样写好像不对吧
    试试这样写对不对
    with ADOQuery1 do begin
      close;
      SQL.Clear;
      SQL.Add('UPDATE 用户清单 SET 密码="'+Trim(Edit3.Text)+'" WHERE 用户名=ComBox1.Items');
      Execsql;
      close;
      

  3.   

    能运行了,可是当修改密码时又出现错误,弹出一个对话框Project SuperManage.exe raised exception class EOLeException with message'列前缀'Combox1'与查询中所用的表名或别名不匹配。’Process stopped.Use step or Run to continue这是错误,需要怎么改正啊?
      

  4.   

    SQL.Add('UPDATE 用户清单 SET 密码='''+Trim(Edit3.Text)+''' WHERE 用户名=ComBox1.text');
      

  5.   

    还是不行,只是能运行,可只要一运行到修改密码这里只要一点修改那buttong 按钮就提示错误
    怎么回事呢???
      

  6.   


      SQL.Add('Delect 密码 from 用户清单 where 用户名='''+ComBox1.text+'''');
      SQL.Add('Insert into 用户清单 (密码) values (:temp)');
      Parameters.ParamByName('temp').Value:=Trim(Edit3.Text);