如下所示:
    AdoQuery1.Connection :=FormPassword.ADOConnection1;
    with AdoQuery1do begin
      //Close;
      SQL.Clear;
      tempstr:='Update Users set PWD='''+trim(Edit2.Text)+''' where UserID='''+UserID+'''';
      SQL.Text:=tempstr;
      open;
    end;
运行时发生错误:Missing Connection or Connectionstring.
不知为何,请赐教!

解决方案 »

  1.   

    可能是ADOQuery1控件没设置好吧?
    检查检查看看?
      

  2.   

    uses formpassword;...
    AdoQuery1.Connection :=FormPassword.ADOConnection1;
        with AdoQuery1 do begin
          Close;
          SQL.Clear;
          tempstr:='Update Users set PWD='''+trim(Edit2.Text)+''' where UserID='''+UserID+'''';
          SQL.Text:=tempstr;
         --> sqlexec;
        end;bad english, try it!
      

  3.   

    可以阿,用ADOConnection1连接了,AdoQuery1.Connection :=FormPassword.ADOConnection1;
    ADOQrury1,sql.clear;
    ADOquery1.sql.add('update tablename set pwd=:p1 where userID=:p2');
    ADOquery1.parameter.parambyname('p1').values:=form1.edit1.text;
    ADOquery1.parameter.parambyname('p2').values:=form1.edit2.text;
    try
    adoqurey1.execsql;
    except end;
      

  4.   

    Update、Delete、Insert必须使用ADOQuery.ExecSQL。
    只有Select才能用Open;
      

  5.   

    I use henreash(虫子)'s and I be told that parameter 'P1' not found,I don't know why?
      

  6.   

    AdoQuery1的Connectionstring或Connection属性没有设置
      

  7.   

    But I have setup connection attribute, the source code as follow:
      AdoQuery1.Connection :=FormPassword.ADOConnection1;
        with AdoQuery1 do begin
          Close;
          SQL.Clear;
          SQL.Add('Update Users set PWD=:P1 where UserID=:P2');
          Parameters.ParamByName('P1').Value :=NewPassword;
          Parameters.ParamByName('P2').Value :=UserID;
          ExecSQL;
        end;
      

  8.   

    make sure ,set  ADOConnection1's ConnectionString and add p1,p2 into AdoQuery1's Parameters
      

  9.   

    可的
    sql_string := 'update tbl_oper set oper_passwd='''+suiedit2.Text+
        ''' where oper_acct='''+ mainform.useracct+'''';
      with datamd.tbl_oper do  //datamd.tbl_oper为另一个单元的adouqery控件
      begin
        active := false;
        sql.Clear;
        sql.Add(sql_string);
        execsql();
      end;