5.4.11 读者信息查询业务
读者信息查询同图书信息查询一样,对应的数据库表是“student”,查询的原则是输入借书证号,然后查询读者相关信息。
图5-28 读者查询业务子窗体设计
代码5-14 读者查询业务功能代码
′****************************************************************************
′窗体加载
Private Sub Form_Load()
lblInfo.Left=Me.ScaleLeft
lblInfo.Top=Me.ScaleTop
lblInfo.Width=Screen.Width
End Sub
′活动窗体事件
Private Sub Form_Activate()
clear
End Sub
′功能函数
Private Sub clear()
txtLibraryId.Text=″″
txtClassId.Text=″″
txtRollNo.Text=″″
txtMemName.Text=″″
txtSex.Text=″″
txtAddress.Text=″″
txtLibraryId.SetFocus
End Sub
′键盘回车
Private Sub txtLibraryId_keypress(KeyAscii As Integer)
Dim LibraryNo As String
LibraryNo=txtLibraryId.Text I
If KeyAscii=13Then
clear
If Not IsNumeric(LibraryNo)Then
MsgBox″无效检索″,vbCritical,″检索错误″
Call clear
Exit Sub
End If
rsMemberInfo.MoveFirst
For i=0To rsMemberInfo.RecordCount
If rsMemberInfo.EOF=True Then
Exit For
End If
If rsMemberInfo(0)=Val(Trim$(LibraryNo))Then
txtClassId.Text=rsMemberInfo(1)
txtRollNo.Text=rsMemberInfo(2)
txtMemName.Text=rsMemberInfo(3)
txtSex.Text=rsMemberInfo(4)
txtAddress.Text=rsMemberInfo(5)
Exit For
End If
rsMemberInfo.MoveNext
Next
If txtClassId.Text=″″Then
MsgBox″不存在该ID号!″,vbInformation,″检索结果″
clear
End If
End If
End Sub
免责声明:以上内容源自网络,版权归原作者所有,如有侵犯您的原创版权请告知,我们将尽快删除相关内容。