try //查询当前时间的数据记录是否已存在
SQLSent:='Select ID from pharosdata where phaCode ='''+Code+''''+'and Type='+IntToStr(J)+' and time='''+ HAPPEN_TIME +'''';
ADOConnection1.Close;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add(SQLSent); ADOQuery1.Open;
QuyRsl:=ADOQuery1.RecordCount;
except
end;数据库里明明有这条记录,但是查询返回QuyRs1=0,大概,是什么原因?
SQLSent:='Select ID from pharosdata where phaCode ='''+Code+''''+'and Type='+IntToStr(J)+' and time='''+ HAPPEN_TIME +'''';
ADOConnection1.Close;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add(SQLSent); ADOQuery1.Open;
QuyRsl:=ADOQuery1.RecordCount;
except
end;数据库里明明有这条记录,但是查询返回QuyRs1=0,大概,是什么原因?
解决方案 »
- 请问哪位大侠可以给我一份Indy的TCP组件传送文件的例程?
- 重庆的朋友,你们一定要帮个忙。
- 在delphi中的TcomboBox控能像asp中的comboBox控件一样吗?
- 关于Tapdcomport控件的问题
- 大家看看这个界面有什么控件可以实现
- 3个难题,请大家帮忙,我用delphi做一个安装程序遇到三个大难题,请高手帮忙。
- 关于ACTIVEFORM在98.2000下执行,显示的问题.(很紧急的)
- 字符串,帮忙啊~~
- 看到高手区的问题无人解答,想给回答一下,没想到竟然无权回答,呵呵... ...
- 我的操作系统是2000 为什么每次开机都跳到安全模式,然后重新启动一下就好了
- 动态生成的TTabSheet 退出要报错
- 简单题目,统计每位数都不相同的算法
try
ADOConnection1.Close;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
SQLSent:='Select ID from pharosdata where phaCode ='''+Code+''''+'and Type='+IntToStr(J)+' and time='''+ HAPPEN_TIME +'''';
ADOQuery1.SQL.Add(SQLSent);
ADOQuery1.Open;
QuyRsl:=ADOQuery1.RecordCount;
except
end;
SQLSent:='Select ID from pharosdata where phaCode ='''+Code+''''+'and Type='+IntToStr(J)+' and time='''+ HAPPEN_TIME +'''';
ADOConnection1.Close;
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add(SQLSent); ADOQuery1.Open;
QuyRsl:=ADOQuery1.RecordCount;
except
end; 数据库里明明有这条记录,但是查询返回QuyRs1=0,大概,是什么原因?>>>>>>>>>>>要先连接数据库,检查一下连接是否正确。
为什么要close?
按楼上的建议把ADOConnection1.Close; 去掉试验一下
自己写的第一步循环把记录改掉了,囧2、习惯了,这些写
当ADOConnection1.Close;
ADOQuery.Open执行后,ADOConnection1,还是会自动Open.