Two episodes of the data room Charging System

Source: Internet
Author: User
Algorithm for daily checkout of recharge balance in the previous period

I was confused at the beginning of the daily checkout. I got a little balance, but sometimes I repeated it many times. So messy. In addition, his system may have checked out multiple times a day, resulting in data redundancy. Unnecessary space resources are wasted.

After thinking about some methods, I looked at some other people's practices and finally checked out only once a day. If I had already checked out today, I would leave the morning balance to the afternoon and delete the morning, if no settlement is made, the balance of yesterday or the last day will be given to today.

Some code is as follows:

Txtsql = "select * From checkday_info where date = '" & format (date, "yyyy-mm-dd") & "'" 'find the balance set objcheckday = executesql (txtsql, msgtext) 'Open the student table if objcheckday. EOF = true then 'query today's records. If the record is empty, release, then obtain the latest balance txtsql = "select * From checkday_info where date <= '" & format (date, "yyyy-mm-dd ") & "'"' find the remaining balance set objcheckday = executesql (txtsql, msgtext) 'Open the student table for objday = 0 to objcheckday. recordcount -1 'record set loop upremain = objcheckday. fields ("allcash") 'gets the balance of the previous period objcheckday. movenext 'Next else txtsql = "select * From checkday_info where date = '" & format (date, "yyyy-mm-dd ") & "'"' find the previous period balance set objcheckday = executesql (txtsql, msgtext) 'Open the student table upremain = objcheckday! Upremaincash 'get today's latest balance objcheckday. delete' record set move down end if
The carriage return event in the text box. How can I set the carriage return function to go to the computer and then go down after the carriage return function?

 At first, I had a headache for this problem. Later I found it was just a paper tiger. I thought it was just like that. Open a table and check it out. If it wasn't there, I got down and got on the machine.

Some code is as follows:

If keyascii = 13 then txtsql = "select * From student_info where car_id = '" & trim (txtcarid. text) & "'" & "and statue = 'use'" set objstudent = executesql (txtsql, msgtext) 'to open the student table if objstudent. EOF = true then' if the card number does not exist, the system prompts msgbox "this card is not registered. Please enter it again", vbokonly + vbinformation, "Warning" Exit sub else txtsql = "select * From lineon_info where car_id = '" & trim (txtcarid. text) & "'"' query the machine table set objlineon = executesql (txtsql, msgtext) 'Open the machine table if objlineon. EOF = false then 'If the card is on the machine, the system prompts cmdoutline. value = true' indicates that else cmdonline is down. value = true' indicates the end if
Use Aggregate functions

First, it describes what an aggregate function is. This is the calculation method of field data in the Set in SQL statements. The set here is the query result. The statement is as follows:

Sqlmax (orders. orderdate) as last trading day from orders

The above statement indicates the maximum value of the drive orderdate in the orders data table. Max is the function, and the "last trading day" after it is the character press, that is, the maximum value in this column. This is a common design for All Aggregate functions.

Group basis

Except for multiple Aggregate functions, grouping, expressions, and conditions in the aggregate have special notation.

For example

Sum (orders. Total) as the total transaction amount from ordres inner join (ordrs. Canceldate is null) group by membres. memberid

 

In the preceding statement, the memberid field is used as the group, and the calculated results of the memberid and the other two are orderid.
The field is calculated as count, the totals field is used as sum, and the where field cannot be blank.

The basic format of this sentence is

Select calculation method (extracted field)... from data table where condition group by grouping Field

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.