Data room charging system-retrieve data from the database through a form

Source: Internet
Author: User

1. When logging on to the system, You need to log on to the user ID and password. If the user exists, the logon is successful.

 

You can only add a user as an administrator, so you can only log on to the system as an administrator.

When a user is added, there is an account owner, which can be obtained from the user_info table.

 

What we need to do now is to obtain the account owner. Because the account owner can only be the administrator, that is, the account owner who adds the user is the administrator who logs on to the system.

Based on the user ID of the logon form, we can find the username in user_info, that is, the account owner.

The following code is used for implementation:

Txtsql = "select * From user_info where userid = '" & trim(frmlogin.txt userid. Text )&"'"

Set MRCC = executesql (txtsql, msgtext)

Txtkaiuser. Text = trim (MRCC. Fields (2 ))

 

2

.

In the data setting table, the account owner is also used to log on to the form to retrieve data.

 

3. Data is also retrieved from the user_info database by using the "user ID" at logon.

'Here, the reason why the user is retrieved from the database is that the username in the frmlogin login form is changed to userid because username cannot uniquely identify a user.
Txtsql = "select * From user_info where userid = '" & trim(frmlogin.txt userid. Text )&"'"
Set MRC = executesql (txtsql, msgtext)


If MRC. EOF = false and trim (MRC. Fields (1) = "general user" then
Operator. Enabled = false
Admin. Enabled = false
End if
 
 
'The functions that the operator can achieve (can perform operations by ordinary users and operators)
If MRC. EOF = false and trim (MRC. Fields (1) = "operator" then
Admin. Enabled = false

End if
End sub

'In another situation, the administrator can perform operations

 

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.