
VFP 表单中设计两个文本框分别输入起止号查找记录,例如查找学号为1---5的学生信息
2个回答
展开全部
t1=alltrim(thisform.text1.value)
t2=alltrim(thisform.text2.value)
sele * from 学生 where 学号>=t1 and 学号<=t2 into cursor "temp"
thisform.grid1.recordsource="temp"
t2=alltrim(thisform.text2.value)
sele * from 学生 where 学号>=t1 and 学号<=t2 into cursor "temp"
thisform.grid1.recordsource="temp"
展开全部
你的学生表里学号最好用数值型。
t1=val(thisform.text1.value)
t2=val(thisform.text2.value)
thisform.grid1.recordsourcetype=4
thisform.grid1.recordsource="sele * from 学生 where 学号>=t1 and 学号<=t2 into cursor temp"
t1=val(thisform.text1.value)
t2=val(thisform.text2.value)
thisform.grid1.recordsourcetype=4
thisform.grid1.recordsource="sele * from 学生 where 学号>=t1 and 学号<=t2 into cursor temp"
更多追问追答
追问
老师你好,我还有个问题请教你
我还要增加一个文本框查找单个姓名我写了以下代码,查找学号没问题,但是用姓名查找时不但查不出结果,反而把第一条记录是姓名修改了
t3=alltrim(thisform.text3.value)
thisform.grid1.recordsourcetype=4
do case
case t1<0 and t2<0
thisform.grid1.recordsource="sele * from zrjh where 姓名=t3 into cursor temp"
endcase
用姓名查找时不用学号,哪里有问题,请指教
追答
为什么要用DO CASE?
t3=alltrim(thisform.text3.value)
thisform.grid1.recordsourcetype=4
thisform.grid1.recordsource="sele * from zrjh where 姓名=t3 into cursor temp"
thisform.grid1.refresh
这样就可以了啊。
怎么会把第一个记录的姓名改了呢?是不是你把文本框和表记录里的字段绑定了?不要绑定!!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询