ifADIQeuery3.SQL:='select count(*) from count3 where V_DTime=:DTime';Showmessage(inttostr(ifADOQuery3.Fields.Fields[0].Value ));
if ifADOQuery3.IsEmpty then
begin
// ifADOQuery3.Close;
inster3ADOQuery.Parameters.ParamByName('Site_ID').Value:=Site_ID;
inster3ADOQuery.Parameters.ParamByName('V_DTime').Value:=V_DTime;
inster3ADOQuery.Parameters.ParamByName('V_View').Value:=V_View;
inster3ADOQuery.Parameters.ParamByName('V_IP').Value:=V_IP;
inster3ADOQuery.ExecSQL;
Showmessage('NULL'+inttostr(Site_ID)+inttostr(V_View)+inttostr(V_IP)+datetimetostr(V_DTime));
m:=m+1;
TeLabel2.Caption:='正在导入表3(View)中的第'+inttostr(m)+'条记录,稍等...';
end
else
...明明我的Count3中没有任何记录,但为什么Showmessage(inttostr(ifADOQuery3.Fields.Fields[0].Value ));总是返回1呢??我用的是ACCSEE
if ifADOQuery3.IsEmpty then
begin
// ifADOQuery3.Close;
inster3ADOQuery.Parameters.ParamByName('Site_ID').Value:=Site_ID;
inster3ADOQuery.Parameters.ParamByName('V_DTime').Value:=V_DTime;
inster3ADOQuery.Parameters.ParamByName('V_View').Value:=V_View;
inster3ADOQuery.Parameters.ParamByName('V_IP').Value:=V_IP;
inster3ADOQuery.ExecSQL;
Showmessage('NULL'+inttostr(Site_ID)+inttostr(V_View)+inttostr(V_IP)+datetimetostr(V_DTime));
m:=m+1;
TeLabel2.Caption:='正在导入表3(View)中的第'+inttostr(m)+'条记录,稍等...';
end
else
...明明我的Count3中没有任何记录,但为什么Showmessage(inttostr(ifADOQuery3.Fields.Fields[0].Value ));总是返回1呢??我用的是ACCSEE
Showmessage(ifADOQuery3.Fields.Fields[0].AsString);
显示的倒是正常了~~~但为什么会这样呢???难到ifADOQuery3.IsEmpty 不能判断吗?
or sql 语句
if ifADOQuery3.IsEmpty then你showmessage在IsEmpty 前面,它怎么判断呢要不你if ifADOQuery3.IsEmpty then换成
if ifADOQuery3.RecordCount=0 then
所以,Showmessage(inttostr(ifADOQuery3.Fields.Fields[0].AsInteger ))的结果为0
并不能证明有记录,你可以试试一个空表,用Showmessage(inttostr(ifADOQuery3.Fields.Fields[0].AsInteger )),你会发现它也是0
它是用来读表的数据记录的啊,faint
'select count(*) from count3 where V_DTime=:DTime';
那么SQL语句是不是要这样写:
'select * from count3 where V_DTime=:DTime';
它永远返回一条记录象你这样showmessage出来后,若表中没有满足你条件的记录,当然会显示0了不要用count(*)呀,直接用select * from .....就可以了
用ADOQeuery3.RENO
或ADOQeuery3.RecordCount都不行我就得关注了!!