procedure TForm10.Button3Click(Sender: TObject);
begin
if edit3.Text='' then
          begin
          showmessage('对不起,密码不能为空!');
          edit2.SetFocus;
          end
     else
         begin
           adoquery1.Close;
           adoquery1.sql.clear;
           adoquery1.SQL.Add('update yhmn set password='''+edit3.text+''' where password='''+edit1.text+'''');
           adoquery1.ExecSQL;
           showmessage('更新密码成功!');
           end;
end;end.

解决方案 »

  1.   

    就是以acess作数据库时提示语法错误,而sql server却不会?
      

  2.   

    是的,acess数据库有加密码,是通过动态连接的谢谢!
      

  3.   

    adoquery1.SQL.Add('update [yhmn] set [password]='''+edit3.text+''' where [password]='''+edit1.text+'''');
      

  4.   

    如果有密码的话,
        你贴出来连接数据库的那句来看看
        可能使你的密码位置写错了
        应该不会出现这种问题的
    Provider=Microsoft.Jet.OLEDB.4.0;Data Source=bill.mdb;Persist Security Info=False;Jet OLEDB:Database Password=quanqing //注意密码的位置
      

  5.   

    adoquery1.SQL.Add('update yhmn set password="'+edit3.text+'" where password="'+edit1.text+'"');
     
    注意是双引号。
      

  6.   

    password是access的关键字,用[]括起来
      

  7.   

    to  DebugXP(NULL) :
        用了你的方法后,程序可以正常运行,但小弟还有一不解之处就是在同一窗体的不同过程,为什么下面这个可以正常运行,而上面这个却不行???
    if edit2.Text='' then
              begin
              showmessage('对不起,用户名不能为空!');
              edit2.SetFocus;
              end
         else
             begin
               adoquery1.Close;
               adoquery1.sql.clear;
               adoquery1.SQL.Add('update yhmn set users='''+edit2.text+''' where password='''+edit1.text+'''');
               adoquery1.ExecSQL;
               showmessage('更新用户名成功!');
               end;
      

  8.   

    回复人: liuhelin(鹤林) ( ) 信誉:109  2005-02-18 10:14:00  得分: 0  
     
     
       password是access的关键字,用[]括起来