机房收费系统——收取金额查询
前言:收取金额窗体总体来说和之前的相比难度有些降低,主要是几个控件的引用
1.DTpicker控件添加
添加过程:工具——部件——控件——“Microsoft Windows Common Controls-2.6.0”——应用——确定
2.MSHFlexGrid控件
添加过程:工具——部件——控件——“Microsoft Hieratchical FlexGrid Control 6.0”——应用——确定
这是在机房中常用的属性,具体在代码有体现
流程图:
代码展示:
rechargeSQL = "select * from Recharge_Info where date >='" & DTPickerbegin.Value & "' and date <='" & DTPickerend.Value & "'" 'where子句可使用运算符
Set rechargemrc = ExecuteSQL(rechargeSQL, rechargeText)
If DTPickerbegin > DTPickerend Then
MsgBox "起始日期大于终止日期", 0 + 48, "提示"
Exit Sub
Else
If rechargemrc.EOF = True Then
MsgBox "无数据", 0 + 48, "提示"
Exit Sub
End If
End If
With MSHFlexGrid1 '填入标题
.Rows = 1
.CellAlignment = 4
.TextMatrix(0, 0) = "卡号" '标题第一行数据
.TextMatrix(0, 1) = "充值金额"
.TextMatrix(0, 2) = "充值日期"
.TextMatrix(0, 3) = "充值时间"
.TextMatrix(0, 4) = "充值教师"
.TextMatrix(0, 5) = "结账状态"
Do While Not rechargemrc.EOF '显示查询数据
.Rows = .Rows + 1
.TextMatrix(.Rows - 1, 0) = rechargemrc.Fields(2)
.TextMatrix(.Rows - 1, 1) = rechargemrc.Fields(3)
.TextMatrix(.Rows - 1, 2) = rechargemrc.Fields(4)
.TextMatrix(.Rows - 1, 3) = rechargemrc.Fields(5)
.TextMatrix(.Rows - 1, 4) = rechargemrc.Fields(6)
.TextMatrix(.Rows - 1, 5) = rechargemrc.Fields(7)
rechargemrc.MoveNext
Loop
End With
rechargemrc.Close
其中查询语句中where子句是本窗体的值得体会的点