Set p = New Recordset
p.LockType = adLockOptimistic
p.CursorType = adOpenStatic
p.Open "select* from a ", cnn1
rs = "准考证号=" & "'" & a2 & "'" & " and " & "考生姓名=" & "'" & _
a3 & "'" & " and " & "考试项目=" & "'" & a4 & "'"
p.Filter = rs
If p.EOF = False Then
a1 = p.Fields("考生姓名").Value
MsgBox a1, vbInformation小弟初涉VB,求详解
p.LockType = adLockOptimistic
p.CursorType = adOpenStatic
p.Open "select* from a ", cnn1
rs = "准考证号=" & "'" & a2 & "'" & " and " & "考生姓名=" & "'" & _
a3 & "'" & " and " & "考试项目=" & "'" & a4 & "'"
p.Filter = rs
If p.EOF = False Then
a1 = p.Fields("考生姓名").Value
MsgBox a1, vbInformation小弟初涉VB,求详解
解决方案 »
- 疑难问题答疑!请高手帮忙!谢谢!万分感谢!
- 请问在VB中怎样制作向导(wizard)对话框?另外怎么样用ini文件保存程序信息(ini文件内容是否有固定格式)?请大家赐教,谢谢!
- 怎么用VB在登陆界面的部分编写验证码的功能?
- 关于datagrid的问题???
- 网络编程的问题,知道inet的来
- 在VB中使用CRYSTAL9 使参数并把值随时在报表显示,在W2000中显示正常,然而在W98中显不乱码,请各位帮忙?谢谢
- 把一个多页pdf格式的文件转换为一个多页的tif文件
- 如何设置ODBC FOR FOXPRO
- 关于excel vba的打印问题
- 急呀!!!!!!!!!!!!!!!!!!!注册表问题!
- 在arcmap状态栏添加显示信息
- 我用vb写了一个程序,程序用到一个txt文件,该txt文件要随时更新,我将txt文件放在网易网盘中,请教如何实现该文件在线更新?
取出表A中 准考证号= a2 并且 考生姓名= a3 并且 考试项目= a4
的样的数据
然后把 考生姓名 这个值 给 a1
条件是 准考证号,考生姓名,考试项目
结果是 考生姓名.若查不到,a1="";查到了,a1=a3
既然已知姓名是a3,还查姓名作甚...
p.LockType = adLockOptimistic
p.CursorType = adOpenStatic
p.Open "select* from a ", cnn1 '这里查询数据库所有记录rs = "准考证号=" & "'" & a2 & "'" & " and " & "考生姓名=" & "'" & _
a3 & "'" & " and " & "考试项目=" & "'" & a4 & "'" p.Filter = rs '这里给记录集设置过滤器,只保留符合条件的记录
If p.EOF = False Then '如果有符合条件的记录,则显示
a1 = p.Fields("考生姓名").Value
MsgBox a1, vbInformation 实际上,完全可以:
Set p = New Recordset
p.LockType = adLockOptimistic
p.CursorType = adOpenStatic
p.Open "select* from a Where 准考证号=" & "'" & a2 & "'" & " and " & "考生姓名=" & "'" & _
a3 & "'" & " and " & "考试项目=" & "'" & a4 & "'", cnn1 If p.EOF = False Then '如果有符合条件的记录,则显示
a1 = p.Fields("考生姓名").Value
MsgBox a1, vbInformation
End If