VB6 and ASP Production Management System 1-vb6 production User Login

Source: Internet
Author: User

I was mentally retarded when I logged on as a user today ......

---------------------------------------------------------------------------------

Tip:

A Password error is always prompted during logon,

Print IIF (TRIM (Rs. Fields ("password") = password, "equal", "not equal ")

It took a long time to find out:

When designing a database for SQL2000, the string in the field should be designed as a variable length (varchar ),

If it is designed to be a char with a fixed length, the database will automatically fill in space if your string is not long enough.

---------------------------------------------------------------------------------

VB6-> Add a form-> Save As login. FRM

Add two labels:

Lable1.caption = "User name :"

Lable2.caption = "Password :"

Add two text boxes:

Name text1 txtuser

Name text2 txtpass

 

The login. frm code is as follows:

1 'user logon code
2 Public sub userlogin ()
3
4 If txtuser. Text = "" then
5 msgbox "user name cannot be blank"
6. txtuser. setfocus
7 exit sub
8 end if
9 If txtpass. Text = "" then
10 msgbox "the password cannot be blank"
11 txtpass. setfocus
12 exit sub
13 end if
14
15 username = trim (txtuser. Text)
16 Password = trim (txtpass. Text)
17
18 call openconn
19
20 SQL = "select * From vuinfo where username = '" & username &"'"
21 Rs. Open SQL, Conn, 1, 1
22' determine whether a user exists
23 if Rs. EOF then
24 msgbox "the user name does not exist"
25 txtuser. setfocus
26 call closeconn
27 exit sub
28 end if
29' determine the user password
30 if Rs. Fields ("password") <> password then
31 msgbox "Incorrect password"
32 call closeconn
33 exit sub
34 else
35 username = Rs. Fields ("username ")
36 Password = Rs. Fields ("password ")
37 userpower = Rs. Fields ("userpower ")
38 call closeconn
39 INFOP. Show
40 unload login 'uninstall login form
41 end if
42 end sub

 

 

Related Article

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.