procedure TForm5.Button1Click(Sender: TObject);
begin
if dblookupcombobox1.Text='' then
begin
 showmessage('请输入标识!!!');
 Exit;
end;
 id:=Table1.Lookup('identifier',dblookupcombobox1.Text,'identifier');
 if edit2.Text<>edit3.Text then
 begin
  showmessage('两个密码不相同');
  exit;
 end
 else
 begin
  query1.Close;
  query1.SQL.Clear;
  query1.SQL.Add('update operatordoc set password='+edit2.Text+'where identifier='+id+'');
  query1.ExecSQL;
  query1.Open;;
  showmessage('密码修改成功!');
  edit2.Text:='';
  edit3.Text:='';
 end;
 end;

解决方案 »

  1.   

    偶先猜一个错误,kekepassword='+edit2.Text  //如果password是字符串类型的话
    呵呵,要写成
    password='+QuotedStr(edit2.Text)
      

  2.   

    对不起,真对不起,老提示:projct project1.exe raised exception class EDBEngineError with message'Invalid field name ORA-00904:无效列名
      

  3.   

    password是字符串类型,则条件要加引号
    where前面好像少了一个空格
      

  4.   

    你用的是Oracle,什么版本?我记得在Oracle7总Password是保留字,不过在8和9种好像不是了。
    不过你的问题陨石的答案的可能性大些。
      

  5.   

    query1.SQL.Add('update operatordoc set password='+edit2.Text+'where identifier='+id+'');
    改成
    query1.SQL.Add('update operatordoc set password='''+edit2.Text+''' where identifier='''+id+''' ');
    这个看看
      

  6.   

    如果tzf_1982(冥界) 说的还不对,你只能检察你字段名有没有错了
      

  7.   

    你的password和identifier字段的属性是什么?是char的属性吗?
      

  8.   

    在语句里多加几个空格呀,我曾经就是这样的问题。query1.Open;;两个分号,是你写错的吗?
      

  9.   

    用showmessage 把那个SQL语句输出来看是不是正确的,可以在数据库中执行一下。错在那里就很明显了。
      

  10.   

    'update operatordoc set password='+edit2.Text+'where identifier='+id+''
    你试试将password字段名改成其他的如pwd,
    另外如果pwd是字符,则语句应改写为
    'update operatordoc set password= '''+edit2.Text+''' where identifier='''+id+'''不过最好采用参数法
    sql:='update operatordoc set pwd=:pwd where identifier=:id'
    query1.Close;
    query1.UnPrepare;
    query1.SQL.Clear;
    query1.SQL.Add(sql);
    query1.ParamByName('pwd').AsString:=Edit1.Text;
    query1.ParamByName('id').AsString:=Edit2.Text;
    query1.Prepare;
    query1.ExecSQL;
      

  11.   

    update 语句参见前面回答//  query1.Open;; 这句删除,update语句不需要open。
      

  12.   

    如果password是char,identifier是int,试试这句SQL
      query1.SQL.Add('update operatordoc set password='''+edit2.Text+'''where identifier='+id+');
      

  13.   

    我已经把password改为pwd了,但是还是不行!
    不知道为什么,很急!
      

  14.   

    begin
     showmessage('请输入标识!!!');
     Exit;
    end;
     id:=Table1.Lookup('identifier',dblookupcombobox1.Text,'identifier');
     if edit2.Text<>edit3.Text then
     begin
      showmessage('两个密码不相同');
      exit;
     end
     else
     begin
      query1.Close;
      query1.SQL.Clear;
      query1.SQL.Add('update operatordoc set pwd='+edit2.Text+' where   identifier='''+id+''' ');
      query1.ExecSQL;
      query1.Open; 
    showmessage('密码修改成功!');
    edit2.Text:='';
    edit3.Text:=''; 
     end;
     end;
    我改成这样之后,执行程序,居然一直出现sql执行(沙漏)标志,没有结果!
      

  15.   

    procedure TForm5.Button1Click(Sender: TObject);
    begin
    if dblookupcombobox1.Text='' then
    begin
     showmessage('请输入标识!!!');
     Exit;
    end;
     id:=Table1.Lookup('identifier',dblookupcombobox1.Text,'identifier');
     if edit2.Text<>edit3.Text then
     begin
      showmessage('两个密码不相同');
      exit;
     end
     else
     begin
      query1.Close;
      query1.SQL.Clear;
      偶觉得应改这里
      query1.SQL.Add('update operatordoc set password='''+edit2.Text+''''+' where identifier='''+id+'''');
      query1.ExecSQL;
      query1.Open;;
      showmessage('密码修改成功!');
      edit2.Text:='';
      edit3.Text:='';
     end;
     end;
    在字符串内的单引号用两个单引号表示,另外where前要有空格否则会合前边的内容连到一起。
      

  16.   

    query1.ExecSQL;
      query1.Open; 
    用了ExecSQL就不能open,用open就出错