设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

一句代码得到表中的某行的指定字段另类方法

1970-1-1 08:00| 发布者: huanghai『文章』| 查看: 1690| 评论: 0

一般情况下我们使用DLOOKUP,或才ADO,DAO来读取记录,这样我们来个比较特殊的用法得到录:

dim strname as string

'方法一:
strname = currentproject.connection.execute("select name from emplyees where id =3").getstring

'方法二:
strname = currentproject.Connection.Execute("("select name from emplyees where id =3")("name")
'----------------------
这个方法中隐式创建了一个ADO的记录集,并使用了记录集的GETSTRING或字段索引的方法得到结果注意:条件字段必须是主键(不重复)


最新评论

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-3 14:09 , Processed in 0.072972 second(s), 16 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

返回顶部