Summary of IDC Charging System

Source: Internet
Author: User

After more than 20 days of exploration, the charging system was finally tested yesterday. Let's talk about the gains of writing this system. Since there is only one executable program, the code inside must be compiled by yourself, especially when a database is created, there are many redundant data items.
First, let's talk about the logical problems: ① The used time is not removed when the card is returned; ② SQL statements can be entered during query, resulting in all the relevant data leakage; ③ when the power is down or wrong, incomplete Data Storage; ④ users in use can be deleted; ⑤ software crashes when multiple users access the database; ⑥ insufficient error handling; for example, users cannot exit the system directly when a software error occurs.
First, the relationship between tables was not fully understood at the beginning. It could also be said that it took a long time to read the table because the SQL statements were too simple. Second, it took a long time to read the table. Record the user information, that is, record the login data when logging on, and record the data to the same row when logging off. At that time, we thought it was very simple to first open the table to record the login information, find the user name and fill in the exit information. However, we encountered a problem at the time of doing this. Because it was added for every login, the table will have the same user name. If we only rely on select, we will change all the information called this user name, this cannot be done. I think of two solutions: one is to rely on bookmark, record bookmarks, and find and modify the bookmarks, but it is not implemented due to the lack of knowledge (I learned more and use this method again ); the second method is: because only one row of information needs to be logged on and off each time, select movelast when closing. In this way, the last row of data is found, then, make a simple modification. There is also the input limit: for example, the number of digits, type, and size must be limited, otherwise unexpected bugs may occur. For example, the question "or" is entered in the query box'
= ''. At this time, the input is processed as an SQL statement, which can be avoided if the input type is restricted.

Some simple but useful knowledge:

1. txtname. TEXT = environ ("computername") Get computer name 2. Shell "Explorer http://lidabsky.blog.163.com" open this URL directly in the browser 3. If MRC. fields (9) = "1" then while MRC. EOF = false mygrid. rows = mygrid. rows + 1' prevents the emergence of blank rows, and also allows the number of rows in the table to expand with the data row. Mygrid. cellalignment = 4 mygrid. textmatrix (mygrid. rows-1, 0) = MRC. fields (0) mygrid. textmatrix (mygrid. rows-1, 1) = MRC. fields (3) MRC. movenext Wend IF4, sent to excel (MRC is recordset) set mybook = myexcel. workbooks. add 'Add a new book set mysheet = mybook. worksheets. add 'Add a new sheet myexcel. visible = true with mysheet. range ("A2 "). copyfromrecordset MRC. printpreview end with can directly send the query results to excel. 5. Delete the specified row dim X as long in mshflexgrid and click the row variable to delete the data x = mygrid in the specified row. row 'delete related data in the database txtsql = "select * From user_info where userid = '" & trim (mygrid. textmatrix (x, 0) & "'" set MRC = executesql (txtsql, txtmsg) while MRC. EOF = false MRC. delete MRC. movenext Wend MRC. close mygrid. removeitem mygrid. rowsel msgbox "this user has been successfully deleted", vbinformation + vbokonly, "deleted successfully" Exit sub

6. When there are multiple conditions, you should first verify the combination of conditions, and then verify other input conditions.

If (combo1.text = "" And combo3.text = "" And combo5.text = "") Then msgbox "write at least one set of conditions for query", vbinformation + vbokonly, "Blank prompt" combo1.setfocus exit sub end if combo1.text = "" Or combo2.text = "" Or txt1.text = "" Then msgbox "should be filled with at least one row of conditions ", vbcritical + vbokonly, "EMPTY prompt" combo1.setfocus exit sub else txtsql = "select * From line_info where" & TJ (combo1) & "" & combo2.text & "" & "'" & txt1.text & "'" end if combo7.text <> "" Then if (combo3.text = "" Or combo4.text = "" Or txt2.text = "") then msgbox "the combination conditions have been selected. Please add the first and second rows of conditions", vbcritical + vbokonly, "Blank prompt" combo3.setfocus exit sub end if (combo3.text <> "" And combo4.text <> "" And txt2.text <> "") then txtsql = txtsql & "" & TJ (combo7) & "" & TJ (combo3) & "& combo4.text &" '"& txt2.text &"' "end if

7. The default period of deposit is "YYYY-M-DD", but when querying the refund amount, the selected period may be "YYYY-M-DD", it may be "YYYY-MM-DD ", at any time is the same day, but VB can not be identified, so sometimes there is data in the table but can not be read out, so the date in the database needs to be changed to a unified format, that is, "YYYY-MM-DD ", the replacement method is format (date, "yyyy-mm-dd"), and the same time is changed to format (date, "HH: mm: SS "). Disadvantages of the original system: when adding a user, the user type is locked and the user type cannot be modified. If the user type is not selected at the beginning, there is no type for the newly added user.
Modification Method: change the original textbox in the add user interface to combo, or change the locked attribute to false.
The biggest thing I feel when writing this system is that I want to do it first. It is not difficult to write code. What's important is that I plan the entire system first and have a macro control to write it easily, you cannot write this form today. You can write another form tomorrow. There is also the feeling that writing programs is messy, and there is an urgent need to learn to scientifically plan software design courses. Otherwise, they will not only be confused, but also very inefficient. After all, what we have mastered is just a little bit of knowledge. I believe that with the continuous learning and accumulation of knowledge, we can write robust, beautiful, and practical software.

Feature thumbnails of the billing system are also attached:

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.