原来这个程序用在ACCESS数据库是没问题的,但是我把这个数据库升级到sql2000后,
运行程序出错提示:
第 1 行: ',' 附近有语法错误
不知为什么?代码如下:
 begin
      begin
        Aqryapp.ExecSQL ;
        Aqrylose.ExecSQL ;
        if CheckBox1.Checked = true then
        begin
          ppReport1.ShowPrintDialog  := false;
          ppReport1.Print;
        end;
        Aqrydel.ExecSQL ;
        Atblstemp.Close ;
        atblstemp.Open ;        DBEditEh1.Text:=vbmh ;
        DBComboBoxEh1.Text:=vlabel;
        dbdatetimeediteh1.Value:= vdate;
        dbedit2.Text :='1';        qryid;
        DBEditEh3.Text := vyyyh;
        DBEditEh3.SetFocus;
      end;
    end;
注释Aqrylose.ExecSQL和Aqrydel.ExecSQL后,就没有问题,不知是不是这两个表的问题?
Aqrylose的SQL属性如下:
UPDATE t_store, t_saletemp SET t_store.dqsl = [t_store].[dqsl]-[t_saletemp].[sl]
WHERE [t_store]![bmh]=[t_saletemp]![bmh] And [t_store]![spbh]=[t_saletemp]![spbh] and [t_store]![clabel]=[t_saletemp]![clabel]
Aqrydel的SQL属性如下:
delete * from t_saletemp
请高手指点,谢谢!!

解决方案 »

  1.   

    delete * from t_saletemp
    应该是
    delete from t_saletemp
    没有*吧!
      

  2.   

    你Aqrylose的SQL和Aqrydel的SQL都有错误update后面只能跟一个表名
    SQL 2000的delete语句不能有*,而Access的delete语句可以有也可以没有
      

  3.   

    呵呵,这个问题解决了,但是Aqrylose表有什么问题呢?谢谢!!
      

  4.   

    http://www.w3school.com.cn/sql/sql_delete.asp
      

  5.   

    如果UPDATE后面只能用一个表的话,那下面SQL语句怎么修改呢?
    UPDATE t_store, t_saletemp SET t_store.dqsl = [t_store].[dqsl]-[t_saletemp].[sl]
    WHERE [t_store]![bmh]=[t_saletemp]![bmh] And [t_store]![spbh]=[t_saletemp]![spbh] and [t_store]![clabel]=[t_saletemp]![clabel]
      

  6.   

    UPDATE t_store SET t_store.dqsl = [t_store].[dqsl]-[t_saletemp].[sl] from t_store,t_saletemp WHERE [t_store]![bmh]=[t_saletemp]![bmh] And [t_store]![spbh]=[t_saletemp]![spbh] and [t_store]![clabel]=[t_saletemp]![clabel]
      

  7.   

    delete 后可以有*;
    update 后可以是多个表
    UPDATE t_store, t_saletemp 
      SET t_store.dqsl = [t_store].[dqsl]-[t_saletemp].[sl]
        WHERE [t_store].[bmh]=[t_saletemp].[bmh] 
           And [t_store].[spbh]=[t_saletemp].[spbh] 
           and [t_store].[clabel]=[t_saletemp].[clabel]
      

  8.   

    update 一般一次更新一个表,比较好,太多表,有问题的。