我用Delphi中的ADOConnection和ADOQuery来对数据库进行操作
,现在有Integer类型的字段Count希望他减一,我这样写的:\
ADOConnection 设置(略)
 With ADOQuery do
     begin
       SQL.Clear;
       SQL.Text:='Update MyTable set Count=Count-1';
       ExecSQL;
     end;
   但是执行时保错,说Update 语句语法错误,请问数据库用Access,delphi中该怎样正确的写这个Update语句呢?

解决方案 »

  1.   

    查看access帮助。
    你这是T-sql语句,有时这些语句中的操作符或者函数对access来说是不兼容的。
    需要使用jet-sql来做。
    你这句如果连sql数据库的话应该是没有问题的。俺手头上没资料,喝了点酒迷糊~~自己查查吧。
      

  2.   

    sql.close;
           SQL.Clear;
           SQL.Text:='Update MyTable set Count=Count-1';
           ExecSQL;
      

  3.   

    With ADOQuery do
         begin
           Close;
           SQL.Clear;
           SQL.Text:='Update MyTable set Count=Count-1';
           ExecSQL;
         end;另外在ACCESS中确定'Update MyTable set Count=Count-1'无误。
      

  4.   

    with Adoquery1  do
        begin
          close;
          sql.claer;
          sql.text.add('update mydatabase set count=count-1');
          execsql;
    end;
      

  5.   

    With ADOQuery do
         begin
           Close;
           SQL.Clear;
           SQL.Text:='Update MyTable set Count=Count-1';
           ExecSQL;
         end;另外在ACCESS中确定Count是数值型