sql.add('where Date ="'+DateToStr(Date)+'"');
    sql.add('and Time ="'+TimeToStr(Time)+'"');
    sql.add('and Alarm = "'+Al+'"');
   引号用的有问题吧?

解决方案 »

  1.   

    请将程序改成:
    with Query1  do
      begin
        if active then close;
        sql.clear;
        sql.add('select * from Alarm');
        sql.add('where Date =" + quotedstr(DateTostr(Date)));
        sql.add('and Time ="+quotedstr(TimeTostr(time)));
        sql.add('and Alarm =" +quotedstr(Al));//al是字符串变量,对吗?
        open;
      end;
      

  2.   

    with Query1  do
      begin
        if active then close;
        sql.clear;
        sql.add('select * from Alarm');
        sql.add('where Date =:N1');
        sql.add('and Time =:N2');
        sql.add('and Alarm = "'+Al+'"');
        parambyname('N1').asDate:=DateToStr(Date);
        parambyname('N2').asTime:=TimeToStr(Time);
        open;
      end;
      

  3.   

    with Query1  do
      begin
        if active then close;
        sql.clear;
        sql.add('select * from Alarm');
        sql.add('where Date =:N1');
        sql.add('and Time =:N2');
        sql.add('and Alarm = "'+Al+'"');
        parambyname('N1').asDate:=DateToStr(Date);
        parambyname('N2').asTime:=TimeToStr(Time);
        open;
      end;
      

  4.   

    你的错误可能是因为你的字段名 Date 是系统的保留字,这种错误尤其在Parado数据库中常见。把字段名 Date 换成别的名称试试。忠告:建立数据库字段不要使用系统保留字!
      

  5.   


    呵呵:)都被楼上那位说了!!
    自己为什么不看看
    Invalid use of Keyword.Token Date
                               ^^^^^^^^^^^ 其实系统已经告诉你了:)
     
      

  6.   


    呵呵:)都被楼上那位说了!!
    自己为什么不看看
    Invalid use of Keyword.Token Date
                               ^^^^^^^^^^^ 其实系统已经告诉你了:)