向access插入日期数据
with FormChart.ADOQuery1 do
begin
Close;
SQL.Clear;
{
ADOQuery1.SQL.Text := 'insert into ip([time],replytime,toip)' + 'values('
+ '#' + FormatDateTime('yyyy-mm-dd hh:nn:ss', now) + '#' + ',' +
QuotedStr(inttostr(replyTime)) + ',' + QuotedStr(ICMP.Host) + ')';
ShowMessage(ADOQuery1.SQL.Text);
}
SQL.Add('insert into ip ([Ontime],replyTime,toIP) values(:#a,:b,:c)');
Parameters.ParamByName('#a').Value :=
FormatDateTime('yyyy-mm-dd hh:nn:ss', now);
Parameters.ParamByName('b').Value := inttostr(replyTime);
Parameters.ParamByName('c').Value := ICMP.Host;
ShowMessage(SQL.Text);
ExecSQL;
end;
如果出现提示找不到fields #a,可以删除项目下所有除pas,dfm,dpr,dproj文件。