请将程序改成: 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;
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;
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;
你的错误可能是因为你的字段名 Date 是系统的保留字,这种错误尤其在Parado数据库中常见。把字段名 Date 换成别的名称试试。忠告:建立数据库字段不要使用系统保留字!
呵呵:)都被楼上那位说了!! 自己为什么不看看 Invalid use of Keyword.Token Date ^^^^^^^^^^^ 其实系统已经告诉你了:)
呵呵:)都被楼上那位说了!! 自己为什么不看看 Invalid use of Keyword.Token Date ^^^^^^^^^^^ 其实系统已经告诉你了:)
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;
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;
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;
呵呵:)都被楼上那位说了!!
自己为什么不看看
Invalid use of Keyword.Token Date
^^^^^^^^^^^ 其实系统已经告诉你了:)
呵呵:)都被楼上那位说了!!
自己为什么不看看
Invalid use of Keyword.Token Date
^^^^^^^^^^^ 其实系统已经告诉你了:)