本文主要是介绍第一次机房收费系统之管理员显示值班教师,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
操作流程:
在窗体加载时直接显示数据。
使用数据库表:
worklog_info(存放用户上下机记录)
具体代码如下:
Option Explicit
Dim H As Single '定义窗体高的变量 '定义窗体高的变量
Dim W As Single '定义窗体高的变量 '定义窗体宽的变量Private Sub cmdOFF_Click()Unload frmDutyTeacher
End SubPrivate Sub Form_Load()H = Me.HeightW = Me.WidthWith MSHFlexGrid.Rows = 1.TextMatrix(0, 0) = "记录号".TextMatrix(0, 1) = "教师".TextMatrix(0, 2) = "级别".TextMatrix(0, 3) = "登录日期".TextMatrix(0, 4) = "登录时间".TextMatrix(0, 5) = "机器名"End With
End SubPrivate Sub Form_Resize()'对worklog_info表操作Dim mrcworklog As ADODB.Recordset '用于存放记录集Dim worklogSQL As String '用于存放SQL语句Dim worklogMsgText As String '用于存放返回信息worklogSQL = "select * from worklog_info where status='True'"Set mrcworklog = ExecuteSQL(worklogSQL, worklogMsgText)'查看是否存在WORKLOG的记录If mrcworklog.EOF = True ThenMsgBox "没有值班教师!", vbOKOnly + vbInformation, "提示"ElseWith MSHFlexGridDo While mrcworklog.EOF = False.Rows = .Rows + 1.CellAlignment = 4.TextMatrix(.Rows - 1, 0) = Trim(mrcworklog.Fields(0)).TextMatrix(.Rows - 1, 1) = Trim(mrcworklog.Fields(1)).TextMatrix(.Rows - 1, 2) = Trim(mrcworklog.Fields(2)).TextMatrix(.Rows - 1, 3) = Trim(mrcworklog.Fields(3)).TextMatrix(.Rows - 1, 4) = Trim(mrcworklog.Fields(4)).TextMatrix(.Rows - 1, 5) = Trim(mrcworklog.Fields(7))mrcworklog.MoveNextLoopEnd Withmrcworklog.CloseEnd IfMe.Height = HMe.Width = WMe.PaintPicture Me.Picture, 0, 0, Me.ScaleWidth, Me.ScaleHeight '实现背景图随窗体变大而改变
End Sub
优化方面:
Dim H As Single '定义窗体高的变量 '定义窗体高的变量
Dim W As Single '定义窗体高的变量 '定义窗体宽的变量
Private Sub Form_Load()H = Me.HeightW = Me.Width
End SubPrivate Sub Form_Resize()Me.Height = HMe.Width = WMe.PaintPicture Me.Picture, 0, 0, Me.ScaleWidth, Me.ScaleHeight '实现背景图随窗体变大而改变
End Sub
这篇关于第一次机房收费系统之管理员显示值班教师的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!