打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
机房收费系统总结

一、判断

1.不需要数据库

1).是否为空字符

2).是否为数字

3).是否前后相同


通用格式:

  1. If Not  Testtxt(txtUserID.Text) Then   
  2.        MsgBox "请输入用户名!", vbOKOnly +vbExclamation, "警告"  
  3.         txtUserID.SetFocus  
  4.         Exit Sub  
  5.     End If  


Testtxt处可以改写成IsNumeric(是否为数字的判断),或者条件也可以写成 
txtIdentifyPWD.Text  <>txtPWD.Text,大家触类旁通就好。

2.需要数据库

1).卡号是否相同

2).卡号是否存在

3).是否有记录的判断


二、SQL语句增、删、改、查


增:

例1:

  1. txtSQL = "select * from User_Info whereLevel='" & Trim(ComboHead.Text) & "'"  
  2. set mrc=ExecuteSQL(txtSQL,MsgText)  
  3. mrc.addnew  

例2:    

  1. txtSQL = "insert into checkday_Info values('" & ReMainCash & "','" &ReChargeCash & "','" &  ConsumeCash &   "','"& Cancel Cash & "','" & AllCash & "','" &Mydate & "')"  
  2.              Set mrc = ExecuteSQL(txtSQL, MsgText)  

删:

例1:     

  1. txtSQL = "delete from User_Info where UserID='" & Trim(DelUser) & "'"  
  2. Set mrc = ExecuteSQL(DelSQL, MsgText)  

改:

例1:

  1. txtSQL = "select * from User_Info whereLevel='" & Trim(ComboHead.Text) & "'"  
  2. set mrc=ExecuteSQL(txtSQL,MsgText)  
  3. mrc.addnew  

例2:   

  1. txtSQL="update student_Info set  cash="& Balance &" where cardno='"& Trim(cardno) &"'"  
  2. set mrc=ExecuteSQL(txtSQL,MsgText)  

查:

    通过两个DTPicker控件 构成的时间段查询:

  1. txtSQL= "select * from CancelCard_Info where Date between '" &CStr(DTPicker1.Value) & "' and'" & CStr(DTPicker2.Value)& "'"  


   计算一个数据库表中记录数量的查询:  

  1. txtSQL= "select Count(*) from OnLine_Info"  

 

   对一个表中的某一项求和的查询:

  1. txtSQL= "select sum(addmoney) from Recharge_Info where UserID='" &Trim(cmbOperatorName) & "'and    status='未结账'"  


三、显示方式

1.text

text的caption属性

2.flexgrid


系统中多采用循环的方式显示flexgrid表格中的内容。
 
  1. With myflexgrid  
  2.         .Font = "微软雅黑"  
  3.         .Font.Size = "16"  
  4.         .Rows = 1  
  5.         .CellAlignment = 4  
  6.         .TextMatrix(0, 0) = "卡号"  
  7.         .TextMatrix(0, 1) = "充值金额"  
  8.         .TextMatrix(0, 2) = "充值日期"  
  9.         .TextMatrix(0, 3) = "充值时间"  
  10.         .TextMatrix(0, 4) = "充值教师"  
  11.         .TextMatrix(0, 5) = "结账状态"  
  12.       
  13.   
  14.     While mrc.EOF = False  
  15.           .Rows = .Rows + 1  
  16.           .CellAlignment = 4  
  17.           .TextMatrix(.Rows - 1, 0) = mrc.Fields(2)  
  18.           .TextMatrix(.Rows - 1, 1) = mrc.Fields(3)  
  19.            .TextMatrix(.Rows - 1, 2) = mrc.Fields(4)  
  20.           .TextMatrix(.Rows - 1, 3) = mrc.Fields(5)  
  21.           .TextMatrix(.Rows - 1, 4) = mrc.Fields(6)  
  22.           .TextMatrix(.Rows - 1, 5) = mrc.Fields(7)  
  23.           mrc.MoveNext  
  24.     Wend  

3.输出到excel表格

  1. Dim i As Integer  
  2.         Dim j As Integer  
  3.         '如果有错误就统一处理,提示没有数据导出    
  4.         On Error Resume Next   
  5.         If myflexGrid.TextMatrix(1, 0) = "" Then  
  6.                 MsgBox "没有数据导出", vbInformation, "提示"  
  7.                 Exit Sub  
  8.         End If  
  9.           
  10.         Dim excelApp As Excel.Application  
  11.         Set excelApp = New Excel.Application  
  12.         Set excelApp = CreateObject("Excel.application")'创建excel对象  
  13.         Dim exbooks As Excel.Workbook  
  14.         Dim exsheet As Excel.Worksheet  
  15.         Set exbook = excelApp.Workbooks.Add'添加新工作簿  
  16.           
  17.         excelApp.SheetsInNewWorkbook = 1  
  18.         excelApp.Visible = True  
  19.           
  20.         With excelApp.ActiveSheet'创建excel工作簿中的行和列  
  21.             For i = 1 To myflexGrid.Rows  
  22.                 For j = 1 To myflexGrid.Cols  
  23.                    .Cells(i, j).Value = "" & Format$(myflexGrid.TextMatrix(i - 1, j - 1))  
  24.                 Next j  
  25.             Next i  
  26.               
  27.         End With  
  28.           
  29.         Set exsheet = Nothing  
  30.         Set exbook = Nothing  
  31.         Set excelApp = Nothing       


4.list

 List1.AddItem "充值教师:" & MyUserID

5.打印预览

Report.PrintPreview (True)

6.报表



本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
用程序来控制一个网页,实现自动输入等操作
VB ORACLE 数据查询问题
VB6.0 导出excel 方法源代码
用VB.NET编写控制excel文件程序
VB6开发Excel任务窗格的例子
在Visual C++ 中调用Excel 2000
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服