Check the association between users and modules developed by the Information System

Source: Internet
Author: User

In the development of information systems, the relationship between users and various information modules is involved. At the beginning of system development and design, planning and design will bring great convenience to future management and other operations. The following is a brief summary of the information system I have seen.
1. automatically generate an ID class for the database
This type of identification is more common when you set an Automatically increasing digital ID in a user table to be different from other information modules. Another type is user identification based on specific rules + random numbers, which is usually accomplished using database triggers, which is common in Enterprise Internal OA systems, for example, you need to identify the department in the employee ID. The first advantage is that the operation is very simple. The disadvantages are: some users have special requirements for the ID, which is usually difficult to change; similar to the random number classification is not intuitive enough; the advantage of the second case is that predefined classification rules can be implemented. The poor part is that development and maintenance are relatively troublesome, And there is basically no way to check errors.

II,ProgramGenerate ID class
In this way, the association between user IDs and various systems is relatively flexible, some rules can be implemented, and maintenance is relatively simple, but the computer resources are relatively large; the second is to generate a random number and place it in a field in the User table. In the future, each system will be associated with it. The advantage is that the implementation details are hidden from users and cannot be counterfeited; the disadvantage is that users are hard to identify. In. net, guid can be used to ensure that there are two methods in ASP:

Code
1 Rem ========== Generate a random number in the specified range ============
2   Function Rndnumber (Min, max)
3   Randomize  
4 Rndnumber = Int (Max - Min +   1 ) *   RND () + Min)
5 End Function  
6
7 Rem ========== Generate a string of the specified length ============
8 Function Getstring (alength, sublength)
9   Dim I, j, result
10   For I = 1   To Alength
11 For J = 1   To Sublength
12 Result = Result &   CHR (Rndnumber ( 97 , 122 ))
13 Next  
14 Result = Result &   " - "
15   Next  
16 Result =   Left (Result, Len (Result) - 1 )
17 Getstring = Result
18 End Function  
19
20

Call method: Strid = getstring (5, 4)

Code
1 Function GUID ()
2 Set Typelib =   Createobject ( " Scriptlet. typelib " )
3 Strguid = Typelib. guid
4 Guid = Strguid
5 End Function

3. user input class Association
This method is commonly based on the user login name, and each information module is associated with it accordingly. This kind of implementation method provides a better way to achieve personalized user selection. It is a good choice for users and programmers.

In the above methods, considering the deletion, the association of User table auto-increment IDS is basically impossible once the system runs, in other implementation methods, if you delete a user without deleting the information of each of its branch systems, the registrant will see the previous information, and the situation will be weighed based on actual needs.

Note thatTo avoid auto-increment ID Association in branch a and Program Generation ID Association in branch B, in the C branch system, username Association is used again. The consequence is that the entire system is messy, causing great trouble for later users.

Supplement: missing a newid () function in the database. It can also be used as a part of the internal data identification. Its implementation method can be a trigger, it can also be executed in the SQL statement of the program. The specific implementation varies from person to person. The probability and probability of this ID repeating are relatively small.

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.