1User name Logon
Since the user name is required to log on to the database for query, but the query statement is wrong, not only does not have data, but the direct consequence is that the system reports errors, it cannot be used before you log on to your system. SoProgramPersonnel should think of all possible situations in advance to ensure the normal use of the software, that is, the fault tolerance of the software is better.
Combined with SQL query statements, if "'" and "=" are avoided, these symbols will directly cause incorrect statements and prompt error messages.
Private sub txtusername_keypress (keyascii as integer) dim s as string dim I as integer for I = 1 to Len (txtusername. text) S = mid (txtusername. text, I, 1) If s like "'" or s like "=" then txtusername = Replace (txtusername. text, S, "") end if next end sub
2 password control
In addition to the basic limits of the user name, you must also consider not to enter Chinese characters. Generally, they are uppercase/lowercase letters (case-sensitive), numbers, and some special characters.
However, there must be a limit on the number of digits, which is a common error.
3 decimal Input
In the beginning, I only wanted to limit the number to be input. But then I thought that if the score is decimal, what should I do? So this decimal must be there? How can I limit decimal places. Limit one decimal point.
Method
Private sub txtcash_change () dim s as string dim X () as string if (isnumeric (txtcash. text) Then X = Split (txtcash. text ,". ") if (ubound (x)> = 1) then if (LEN (x (ubound (x)> 1) Then txtcash. TEXT = s txtcash. selstart = Len (txtcash. text) end if S = txtcash. text end sub
4I have never thought about some extreme situations
(In fact, this is the most important thing to consider)
Database A has no data, and a lot of data is used for testing.
B. For example, if the student ID is defined as a number and dozens of numbers are entered, an error occurs because the number is out of range, but no error message is returned.