对c:\employee.dbf执行更新操作,代码如下:
——————————————————————————————————————
ADOConnection1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\;Extended Properties=dBase 5.0;Persist Security Info=False ';
ADOConnection1.Connected := True;with ADOQuery1 do
begin
  Active := False;
  Connection := ADOConnection1;
  SQL.Clear;
  SQL.Add('update employee set pay=200 where worktime=3');
  ExecSQL;
end;
——————————————————————————————————————
程序运行时报错“update语法错误”。
不知道update语句应该怎么写?

解决方案 »

  1.   

    update employee set pay='''+trim(edit1.text)+''' where worktime='''+trim(edit2.text)+'''
      

  2.   

    直接用ADOConnection1执行sql语句就行了
    ADOConnection1.Execute('update employee set pay=200 where worktime=3');
      

  3.   

    ADOQuery1.Connection := ADOConnection1;with ADOQuery1 do
    begin
      Close;
      SQL.Clear;
      SQL.Add('update employee set pay=200 where worktime=3');
      ExecSQL;
    end;
      

  4.   

    ADOQuery1.Connection := ADOConnection1;with ADOQuery1 do
    begin
      Close;
      SQL.Clear;
      SQL.Add('update employee set pay='''200''' where worktime='''3'''');
      ExecSQL;
    end;