有新发现:Locate should return True if a record is found that matches the specified criteria and the cursor repositioned to that record.这是帮助中说的.也就是返回值要为TRUE有两个条件 1.a record is found that matches the specified criteria 2.the cursor repositioned to that record. 但我不知道指针重新配置是什么意思,该怎样实现. 望高手们指点
卧蝶: 这个EASY!
query.close; query.sql.clear; query.sql.add(select * From test); try query.open except query.excute end; if query.eof then begin showmessage('没找到记录'); end;
卧蝶:这个easy! 建议你使用QUERY空间 query.Close; query.sql.clear; query.sql.Add('select * from hr_post'); query.open; if query.eof then showmessage('没找到记录') else showmessage('有记录');
有新发现:Locate should return True if a record is found that matches the specified criteria and the cursor repositioned to that record.这是帮助中说的.也就是返回值要为TRUE有两个条件 1.a record is found that matches the specified criteria 2.the cursor repositioned to that record. 但我不知道指针重新配置是什么意思,该怎样实现. 望高手们指点
2、建议使用sql语句进行查询。
使用sql语句进行查询怎么确定是否有符合条件的记录?难道生成一个表,判断它是否为空吗?太麻烦了吧.to lanbaba:
我输入的是汉语不存在大小写的问题吧.
form1.query2.locate('xxmc',edit3.text,[])
我需要完全匹配
绝对有符合条件的记录,我用DATABASE DESKTOP看过
我的确试了好久,我说过我在另外一个程序中试了同一条语句值又为TRUE,
我想问问你们高手是否有可能是QUERY.locate本生有什么限定之类的问题
声明:我决不是个懒惰的人
begin
close;
sql.clear;
sql.add('select * from tablename where xxmc=:t1');
params[0].value:=trim(edit3.text);
Open;
end;
如何得到是否找到没有的信息呢
2、with query do
begin
close;
sql.clear;
sql.add('select * from tablename where xxmc='+edit3.text);
Open;
end;
'select * from tablename where xxmc='+edit3.text
1.a record is found that matches the specified criteria
2.the cursor repositioned to that record.
但我不知道指针重新配置是什么意思,该怎样实现.
望高手们指点
query.close;
query.sql.clear;
query.sql.add(select * From test);
try
query.open
except
query.excute
end;
if query.eof then
begin
showmessage('没找到记录');
end;
query.sql.clear;
query.sql.Add('select * from hr_post');
query.open;
if query.eof then
showmessage('没找到记录')
else
showmessage('有记录');
1.a record is found that matches the specified criteria
2.the cursor repositioned to that record.
但我不知道指针重新配置是什么意思,该怎样实现.
望高手们指点
大小写先不要忽略,试试
if locate('xxmc',edit3.text,[loCaseInsensitive]) then
showmessage('找到');
你好!你的短消息,我收到了。我觉得你的语法有点问题!
一般LOACTE语句是对Table控件进行操做的。应该这样:
var
LocateSuccess : Boolean;
SearchOptions : TLocateOptions;
begin
LocateSuccess := Table2.Locate('xxmc',edit3.text);
if LocateSuccess then
showmessage('查找成功')
else
showmessage('查找失败');
end; 你若加了[loCaseInsensitive]选项,表示忽略大小写,若你要
严格匹配,就别加[loCaseInsensitive] 祝你好运! ATCG