请教这样写对吗?
Private Sub Command2_Click()
Dim tempstr As String
Dim zwh As Integer
Dim adoRS As New ADODB.Recordset
Dim tempsql As String
Dim bh As String
Dim name As String
Dim start_time As Date
Dim end_time As Date
Dim stunum As String
Dim date_in As Date
Dim notice As String
st:
tempstr = InputBox("请输入座位号:", "资料归还")
If tempstr = "" Then Exit Sub
zwh = CInt(tempstr)
If zwh < 0 Or zwh > 100 Then
MsgBox "请输入正确的座位号!"
GoTo st
End If
tempsql = "select * from borrow where zwh =" & zwh
adoRS.Open tempsql, db, adOpenStatic, adLockOptimistic
If adoRS.EOF Then
MsgBox "没有这个座位号!请重试!"
adoRS.Close
GoTo st
End If
bh = adoRS("zlno")
name = adoRS("zlmc")
stunum = adoRS("stunum")
start_time = adoRS("start_time")
end_time = Time
date_in = Date
adoRS.Close
notice = "请收回资料编号为:" + bh + " 片名为:" + name + " 的录像带"
Dim res
res = MsgBox(notice, vbOKCancel, "请注意")
If res <> vbOK Then
Exit Sub
End If
tempsql = "delete * from borrow where zwh =" & zwh
adoRS.Open tempsql, db, adOpenStatic, adLockOptimistic