首先读取一个记录的该3个字段 if 系统(归还时间)时间>“归还时间”then label.caption="***" label.color=vbred end if
if date()>rs("开始时间)+rs("影片时长") then label.caption="***" label.color=vbred end if
请教这样写对吗? 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
if 系统(归还时间)时间>“归还时间”then
label.caption="***"
label.color=vbred
end if
label.caption="***"
label.color=vbred
end if
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
tempsql = "update lxzlt set counts = counts + 1 where zlno ='" & bh & "'"
adoRS.Open tempsql, db, adOpenStatic, adLockOptimistic
If DateAdd("n", 20, start_time) < Time Then
tempsql = "insert into bak(zlno,zlmc,zwh,stunum,start_time,end_time,date_in) values('" & bh & "','" & name & "','" & zwh & "','" & stunum & "','" & start_time & "','" & end_time & "','" & date_in & "')"
adoRS.Open tempsql, db, adOpenStatic, adLockOptimistic
End If
jishu = jishu - 1
Label1.Caption = "当前借阅总人数:" & CStr(jishu)
Set grdDataGrid.DataSource = Nothing
adoPrimaryRS.Requery
Set grdDataGrid.DataSource = adoPrimaryRS
sizegrid
If Time() > end_time Then
grdDataGrid.Caption = "guihuanle"
grdDataGrid.Color = vbRed
End IfGoTo st
End Sub