with myxdatas.QAccounts do
    begin
      close;
      sql.Clear;
      sql.Add('UPDATE accounts ');
      sql.Add('SET password='''+Edit2.text+'''  ');
      sql.Add('WHERE accounts='''+ComboBox2.text+''' ');
      ExecSQL;
    end;
运行到ExecSQL就出错,数据库是Access;

解决方案 »

  1.   

    什么错误?引用字符串请使用quotedstr()
      

  2.   

    提示说 :UPDATE 语法错误
    写成这样也错误
    with myxdatas.QAccounts do
        begin
          close;
          sql.Clear;
          sql.Add('UPDATE accounts ');
          sql.Add('SET password= :pw  ');
          sql.Add('WHERE accounts= :accountsName ');
          parameters.paramByName('accountsName').value:= ComboBox2.text;
          parameters.paramByName('pw').value:= edit2.text;  
          ExecSQL;
        end;
      

  3.   

    寫成這樣呢:
          parameters.params[0].asString:= ComboBox2.text;
          parameters.params[1].asString:= edit2.text;  
    如果還不行:
    var s:string;s:=' UPDATE accounts SET password='+''''+Edit2.text+''''+
       ' WHERE accounts='+''''+ComboBox2.text+'''';sql.Add(s);
    ExecSQL;
      

  4.   

    sql.Add('WHERE accounts='''+ComboBox2.text+''' ');
    where之前是否空点?
      

  5.   

    with myxdatas.QAccounts do
        begin
          close;
          sql.Clear;
          sql.Add('UPDATE accounts SET password= :pw  WHERE accounts= :accountsName ');
          parameters.parameters[1].value:= ComboBox2.text;
          parameters.parameters[0].value:= edit2.text;  //不要用简写
          ExecSQL;
        end;
      

  6.   

    var s:string;s:=' UPDATE accounts SET password='+''''+Edit2.text+''''+
       ' WHERE accounts='+''''+ComboBox2.text+'''';
      

  7.   

    你的 myxdatas.QAccounts 做过查询没有?如果这样请使用myxdatas.QAccounts1来做execsql。
      

  8.   

    错误是 Raise exception class EoleException with message ‘UPDATE 语句的语法错误’....