select * into cursor tmp from 资格审查 where 姓名=thisform.text1.text and 工号=val(thisform.text2.text)
-------------------------------------------------------
into 到一个临时表里就不显示了。
found()用于判断seek,locate for等定位记录结果(是否找到)
看系统变量_tally的值就能知道返回的记录数。
-------------------------------------------------------
into 到一个临时表里就不显示了。
found()用于判断seek,locate for等定位记录结果(是否找到)
看系统变量_tally的值就能知道返回的记录数。
into可以到一个变量吗?或者查找到记录的其中一个或几个字段的值到数组?应该可以的吧?(纯粹空想)
select table
set order to tagname
SEEK thisform.text1.value + thisform.text2.value
do while .not. eof .and. (thisform.text1.value=name .and. val(thisform.text2.value)=id)
你想要的值
end do这样的速度相对会快一些.
如果不想让它显示、net_steven说了
found()寻找某个(结果)集中的特定元素、一定要在这儿用?
mudong(木东) 已经解释很清楚了
loca for xm="流星尔"
if found()
messagebox("他正在看帖子!")
else
messagebox("不在看帖子,就在打游戏!")
endif至于sql语句的用法。一般都会查询到的结果防到一个指定的地方。into table,into cursor,into array.很多。像你这样,最好用set filt to.将一个grid和一个表绑定。
sele table
set filt to 姓名=thisform.text1.text and 工号=val(thisform.text2.text)
go top
locate for ,;
姓名=thisform.text1.text and 工号=val(thisform.text2.text)
if found()
* 将结果写入数组
copy to array foundrec [FIELDS FieldsList],;
where 姓名=thisform.text1.text and 工号=val(thisform.text2.text)
else
=messagebox('没有找到符合条件的记录',64,'')
endif也可改进一下,
select 资格审查
count to foundrec_count for ,;
姓名=thisform.text1.text and 工号=val(thisform.text2.text)
if foundrec_count>0
* 将结果写入数组
wait window nowait "共找到 "+alltrim(str(foundrec_count))+" 条记录"
copy to array foundrec [FIELDS 需要的字段],;
where 姓名=thisform.text1.text and 工号=val(thisform.text2.text)
else
=messagebox('没有找到符合条件的记录',64,'')
endif
2、select查询结果如果不想显示的话,就象楼上所说的可以把查询结果存放在cursor或者是临时表中,不过,在你的这个表单中,我的看法是与liujianjun_(流星尔)一致,你只需用set filter to 把符合条件的记录过滤出来然后绑定到控件grid表格中即可。
将满足条件的数据绑定到Grid,
建Grid 后知道怎么作了,
我也没有经验。
你试试吧。
比如你要查询那你就在你编写查询语句的地方(也就是你写SQL语句的地方),换上
liujianjun_(流星尔) 写的:
sele table
set filt to 姓名=thisform.text1.text and 工号=val(thisform.text2.text)
加一句:
thisform.refresh然后在grid中设recordsource为你的数据表名
OK!