Vb 使用recordset.find问题
PrivateSubCommand1_Click()IfText1.Text=""ThenMsgBox("未填写被访问学生学号!")Text1.SetFocusElseS...
Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox ("未填写被访问学生学号!")
Text1.SetFocus
Else
StudentN = Text1.Text
Student.Recordset.Find ( "Student_ID = '" & StudentN & "'", , adSearchForward, 1) '这句话总是显示少了“=”为什么?
If Student.Recordset.EOF Or Student.Recordset.BOF Then
MsgBox ("无此学生!")
Form4.Hide
Exit Sub
Else
Text1.Text = Student.Recordset!Student_ID
Text2.Text = Student.Recordset!Student_Name
Text3.Text = Student.Recordset!Gender
roomID = Student.Recordset!Room_ID
Image1.Picture = Student.Recordset!Photo
Dormitory.Recordset.Find "R_ID = '" & roomID & "'", , adSearchForward, 1
Text4.Text = Dormitory.Recordset!Room
Text5.Text = Dormitory.Recordset!Campus
Text6.Text = Dormitory.Recordset!Building
End If
End If
End Sub 展开
If Text1.Text = "" Then
MsgBox ("未填写被访问学生学号!")
Text1.SetFocus
Else
StudentN = Text1.Text
Student.Recordset.Find ( "Student_ID = '" & StudentN & "'", , adSearchForward, 1) '这句话总是显示少了“=”为什么?
If Student.Recordset.EOF Or Student.Recordset.BOF Then
MsgBox ("无此学生!")
Form4.Hide
Exit Sub
Else
Text1.Text = Student.Recordset!Student_ID
Text2.Text = Student.Recordset!Student_Name
Text3.Text = Student.Recordset!Gender
roomID = Student.Recordset!Room_ID
Image1.Picture = Student.Recordset!Photo
Dormitory.Recordset.Find "R_ID = '" & roomID & "'", , adSearchForward, 1
Text4.Text = Dormitory.Recordset!Room
Text5.Text = Dormitory.Recordset!Campus
Text6.Text = Dormitory.Recordset!Building
End If
End If
End Sub 展开
展开全部
语句有问题啊
等号怎么用中文全角等号?
Student.Recordset.Find ( "Student_ID = '" & StudentN & "'", , adSearchForward, 1)
等号怎么用中文全角等号?
Student.Recordset.Find ( "Student_ID = '" & StudentN & "'", , adSearchForward, 1)
追问
不是中文的等号,我特地从别的地方复制等号过去,效果都一样……
追答
晕了。如果不是等号的问题,那就好解决了。
你把括号去掉就可以了。
Student.Recordset.Find ( "Student_ID = '" & StudentN & "'", , adSearchForward, 1) ,这样是必须要有返回值的
TempValue=Student.Recordset.Find ( "Student_ID = '" & StudentN & "'", , adSearchForward, 1)
或者
Student.Recordset.Find "Student_ID = '" & StudentN & "'", , adSearchForward, 1
这样就应该解决了吧。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询