open处应该为execsql吗?试过还是不行的。
我想判断是不是有满足条件的记录存在,而且我想问一下,在执行完sql语句后,指针是不是就对着满足条件的记录了呀,还是已经到末尾了呢?
我想判断是不是有满足条件的记录存在,而且我想问一下,在执行完sql语句后,指针是不是就对着满足条件的记录了呀,还是已经到末尾了呢?
解决方案 »
- 请问用Delphi7开发软件如何解决双核CPU多线程调用问题?
- 请问如何另存网页中已经显示的一张图片(不要重新从网上下载)
- 怪怪怪!!事务处理的问题,出现一次出错后再用事务就出问题了
- 问一个关于cpu序列号的问题!
- 为何我的fastReport在使用showReport方法时,显示不出来?
- 如何找出局域网中安装了我的应用程序服务器的所有机器
- 有人说:“软件开发就是制造问题,然后解决问题”,大家谈谈看法!
- //********************如何得到代码的当前行号***************************
- 怎样获取宽带上网的服务器地址,如果本地有多个网卡又怎样
- 如何使用SQL?
- 求解:如何在dephi中调用*.chm帮助文件?谢谢!
- 各位,请有report组件的使用说明,请给我一份[email protected]
试一试,看看那样行么?:)
或者把你的SQL语句改为:'select number=count(*) number from E_BASIC where ecode='''+edit1.text+''''
要是你的Ecode字段的类型不是字符型的话,应为:'select number=count(*) number from E_BASIC where ecode='+edit1.text+''
祝你好运:)
'select count (*) as a from E_BASIC where ecode='''+edit1.text+''''
然后fieldbyname('a').Asinteger>0 then其实如果要判断某条记录是否存在可以这样:
sql:
select * from E_BASIC where ecode='''+edit1.text+''''
然后判断时:
query1.first;
if not query1.eof then then
showmessage('right');
执行完sql语句后,指针应该对着满足条件的记录了
我用select count (ecode) as number from e_basic where ecode='''+edit1.text+''';
if fieldbyname('ecode').asinteger >0 then
show message('found');
但是仍然出现"未找到预期from关键字”。我昨天试了不用关键字,还是不行的,就用了hzb的后一种方法才运行通过的,就是未用到select(*),今天再试了一遍select(*),倒是可以用了,delphi可真会变的。
我等LaoZheng看一下我上面提的问题后,再来给分哦,不要着急,不要着急,嘻嘻。
with query1 do
begin
Close;
Unprepare;
SQL.Clear;
SQL.Add('select count (ecode) as number from e_basic where ecode=:ecode');
ParamByName('ecode').AsString:=edit1.text;
Prepare;
Open;
end;
if (not query1.fieldbyname('number')=0) then
showMessage('right!');
我一直都是这样用,没问题的。