博客
关于我
【第一次机房收费系统】-收取金额查询
阅读量:346 次
发布时间:2019-03-04

本文共 1556 字,大约阅读时间需要 5 分钟。

一、思维导图

通过对数据库中的充值信息进行分析,可以清晰地了解不同时间段内的充值数据分布情况。通过筛选特定日期范围内的记录,能够快速定位到相关的充值数据。

二、代码展示

以下是基于VBA的实现代码,用于从数据库中查询指定日期范围内的充值信息,并将结果填充到表格中。

Private Sub cmdInquiry_Click()
Dim mrc As ADODB.Recordset
Dim txtSQL As String
Dim MsgText As String
' 查询选定范围里的数据
txtSQL = "select * from Recharge_Info where date > '" & begindate.Value & "' and date < '" & enddate.Value & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF Then
MsgBox "该时间段无数据", vbOKOnly, "温馨提示:"
Exit Sub
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 mrc.EOF
.Rows = .Rows + 1
.CellAlignment = 4
.TextMatrix(.Rows - 1, 0) = Trim(mrc.Fields(2))
.TextMatrix(.Rows - 1, 1) = Trim(mrc.Fields(3))
.TextMatrix(.Rows - 1, 2) = Trim(mrc.Fields(4))
.TextMatrix(.Rows - 1, 3) = Trim(mrc.Fields(5))
.TextMatrix(.Rows - 1, 4) = Trim(mrc.Fields(6))
.TextMatrix(.Rows - 1, 5) = Trim(mrc.Fields(7))
mrc.MoveNext
Loop
End With
End Sub

三、代码功能解析

该代码主要用于从数据库中查询特定日期范围内的充值信息,并将结果显示在表格中。具体实现步骤如下:

  • 定义必要的变量,包括记录集对象mrc、SQL语句字符串txtSQL以及提示信息字符串MsgText
  • 构建查询SQL语句,指定开始日期和结束日期范围。
  • 执行查询,并检查是否存在记录。如果无记录,则显示提示信息并退出程序。
  • 将查询结果填充到表格中,包括卡号、充值金额、充值日期、充值时间、充值操作员和结账状态等字段。
  • 逐个循环填充表格数据,直至所有记录处理完毕。
  • 转载地址:http://mthe.baihongyu.com/

    你可能感兴趣的文章
    NoNodeAvailableException None of the configured nodes are available异常
    查看>>
    Vue.js 学习总结(16)—— 为什么 :deep、/deep/、>>> 样式能穿透到子组件
    查看>>
    nopcommerce商城系统--文档整理
    查看>>
    NOPI读取Excel
    查看>>
    NoSQL&MongoDB
    查看>>
    NoSQL介绍
    查看>>
    NoSQL数据库概述
    查看>>
    Notadd —— 基于 nest.js 的微服务开发框架
    查看>>
    NOTE:rfc5766-turn-server
    查看>>
    Notepad ++ 安装与配置教程(非常详细)从零基础入门到精通,看完这一篇就够了
    查看>>
    Notepad++在线和离线安装JSON格式化插件
    查看>>
    notepad++最详情汇总
    查看>>
    notepad++正则表达式替换字符串详解
    查看>>
    notepad如何自动对齐_notepad++怎么自动排版
    查看>>
    Notes on Paul Irish's "Things I learned from the jQuery source" casts
    查看>>
    Notification 使用详解(很全
    查看>>
    NotImplementedError: Cannot copy out of meta tensor; no data! Please use torch.nn.Module.to_empty()
    查看>>
    NotImplementedError: Could not run torchvision::nms
    查看>>
    nova基于ubs机制扩展scheduler-filter
    查看>>
    Now trying to drop the old temporary tablespace, the session hangs.
    查看>>