Private Sub Command1_Click ()
If txtuname. Text="" Then
MsgBox "the user name cannot be empty. Please enter the user name!" VbCritical, "tip"
The Else
Rs. MoveFirst
Rs.='" Find "uname & amp; Trim (txtuname. Text) & amp; "'
"If the rs. EOF Then
Txtuname. Text=""
Txtupwd. Text=""
Txtuname. SetFocus
MsgBox "user name input error, please choose!" VbCritical, "tip"
The Else
If txtupwd. Text="" Then
MsgBox "password cannot be empty. Please enter a password!" Vbctitical, "tip"
Txtupwd. Text=""
Txtupwd. SetFocus
ElseIf rs. Fields (" upwd ")=txtupwd. The Text Then
The Select Case rs. Fields (" righ ")
Case 0
If cmbright. Text="administrator" Then
MsgBox "the administrator login successfully!" VbExclamation, "tip"
The Else
MsgBox "you don't have the permission!" , vbOKOnly + vbCritical, "tip"
End the If
Case 1
If cmbright. Text="teachers" Then
MsgBox "teacher has successfully landed!" VbExclamation, "tip"
The Else
MsgBox "you don't have the permission!" , vbOKOnly + vbCritical, "tip"
End the If
Case 2
If cmbright. Text="students" Then
MsgBox "student login successfully!" VbExclamation, "tip"
The Else
MsgBox "you don't have the permission!" , vbOKOnly + vbCritical, "tip"
End the If
End the Select
The Else
MsgBox (" password input error, please input again!" ), vbCritical, "tip"
TXTPWD. Text=""
TXTPWD. SetFocus
End the If
End the If
End the If
End Sub
Private Sub Command2_Click ()
Unload Me
End Sub
Private Sub Form_Load ()
CenterForm Me
Set the conn=New ADODB. Connection
Set the rs=New ADODB. You
Conn. Open "the Provider=SQLOLEDB. 1; Integrated Security=SSPI; Persist Security Info=False; Initial Catalog=login; The Data Source=. \ mssql2008
"Rs. Open the "select * from the login", conn, 2, 2
Cmbright. AddItem "administrator"
Cmbright. AddItem "teachers"
Cmbright. AddItem "students"
End Sub
The database connection to write inside the public module
Public conn As ADODB. Connection
Public rs As the ADODB library you
Sub CenterForm (Chile As the Form)
Dim the dw As Integer
Dim dh As Integer
Dw=Screen. Width - Chile. Width
Dh=Screen. Height - Chile. Height
Chile. Top=dh/2
Chile. Left=dw/2
End Sub
: ask ace to give advice or comments to the select () method returns the result set of the rs. Text error, how should I change
CodePudding user response:
What wrong? The error message?CodePudding user response:
Txtuname. Text errorCompile error
To find a way or data member
CodePudding user response:
Put a TextBox, on the form name to txtuname,CodePudding user response:
Your form input the user name text box is not txtuname,To control or change the code,
CodePudding user response:
The name is
CodePudding user response:
The mistake is txtuname . The TextCodePudding user response:
Properties dialog box shows the txtuname (0) , that this is a control array,Find below the index attribute, the value 0 is ok,
CodePudding user response:
A problem seems to be no problem beforeBut have a puzzling question
Suggests that Private Sub Command1_Click () to define a variable
Please explain
CodePudding user response:
You delete the code, double-click directly controls the system generated code framework, then add the application code,CodePudding user response:
Too much is usually a compiler error, will lead to errors indicate position is not accurate,Code all comments up first, piecewise liberalised, F5 full compilation, correct all,
Remember to the Options dialog box, under the General page of the Compile check On Demand are removed,
CodePudding user response:
The