代码如下:
With   ADOQuery1   Do   
  BEgin   
  Close;   
  SQL.Clear;   
  SQL.Add('update tUser set iUn=1,dtime1='1899-12-30 02:00:00',dtime2='1899-12-30 08:00:00' where scardid='''+Form1.Edit2.Text+''''');   
execSQL; 
end;
报:[错误]Unit1.pas(86): missing operator or semicolon
请问这是怎么回事的?
我是新手..

解决方案 »

  1.   

    SQL.Add('update tUser set iUn=1,dtime1='1899-12-30 02:00:00',dtime2='1899-12-30 08:00:00' where scardid='''+Form1.Edit2.Text+'''''); 
    改成
    SQL.Add('update tUser set iUn=1,dtime1='''1899-12-30 02:00:00''',dtime2='''1899-12-30 08:00:00''' where scardid='''+Form1.Edit2.Text+'''''); 
      

  2.   

    还是不行.检查了一下.错误不在符号,而是在1899-12-30的这个"-"号,所以打算用edit.txt来替代..
      

  3.   

    SQL.Add('update tUser set iUn=1,dtime1='''1899-12-30 02:00:00''',dtime2='''1899-12-30 08:00:00''' where scardid='''+Form1.Edit2.Text+'''''); 
    使用这个还是一样的报错...汗....
      

  4.   

    SQL.Add('update tUser 
    set iUn=1,
    dtime1=to_date(''1899-12-30 02:00:00'',''RRRR-MM-DD HH24:MI:SS''),
    dtime2=to_date(''1899-12-30 08:00:00'',''RRRR-MM-DD HH24:MI:SS''
    where scardid='''+Form1.Edit2.Text+'''');  
    记得结帖给分,谢谢!
      

  5.   

    SQL.Add('update tUser 
    set iUn=1, 
    dtime1=to_date(''1899-12-30 02:00:00'',''RRRR-MM-DD HH24:MI:SS''), 
    dtime2=to_date(''1899-12-30 08:00:00'',''RRRR-MM-DD HH24:MI:SS'') 
    where scardid='''+Form1.Edit2.Text+'''');  
    少了个括号……
      

  6.   

    非常感谢你的方法,但还是有以下的问题.
    检测到错误类:E0leException,错误信息:''to_date'不是可以识别的函数名,进程中止,
      

  7.   

    With  ADOQuery1  Do  
      BEgin  
      Close;  
      SQL.Clear;  
      SQL.Add('update tUser set iUn=1,dtime1='+''''+'1899-12-30 02:00:00'+''''+',dtime2='+''''+'1899-12-30 08:00:00'+''''+'  where scardid='+''''+Form1.Edit2.Text+'''');  
    execSQL; 
    end; 
      

  8.   

    'to_date' 是 Oracle 数据库的日期转换写法。
    我用的是 Oracle 数据库,你的不是……
    抱歉,这个是习惯性思维,我考虑太少了。其实,你的错误在于这里(三楼)——scardid='''+Form1.Edit2.Text+'''''); 
    多了一个',应该是四个,而你写了五个。
      

  9.   

    SQL.Add('update tUser set iUn=1,dtime1='+QuotedStr('1899-12-30 02:00:00')+',dtime2='+QuotedStr('1899-12-30 08:00:00')+'  where scardid='+QuotedStr(Form1.Edit2.Text));这个简单一点