K karboy Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-18 #1 大吓们: 我已经知道某一记录的ID号,如何有效地判断在数据库中这条记录是否存在着?
L LeeChange Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-18 #2 select count(*) from tablename where ID=:youID 结果为0则存在
R redrain Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-18 #3 select count(*) from tablename where ID=:youID 结果为0则不存在
B bswilson Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-18 #4 select count(*) from tablename where ID=:youID if eof then the record is not exist.
Z zhuwei02 Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-18 #5 sql.text:='select * from table where id=yourid'; open; if recordcount=0 then 记录不存在 else 有记录
H hly Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-18 #6 还有一种方法 sql代码 "if exists (select * from table where id=yourid) else "
B book523 Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-18 #7 方法很多啊,不过用locate定位不错啊 adodataset和该表相连 if adodataset.locate('id',id的具体值,[]) then 记录存在 else 记录不存在
H hbezwwl Unregistered / Unconfirmed GUEST, unregistred user! 2002-04-18 #8 三种方法:sql语句select locate,findkey filter