mname = Text1.Text
pass = Text2.Text
Dim mycn As New ADODB.Connection
Dim myrs As New ADODB.Recordset
Set myrs = New ADODB.Recordset
mycn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=mang.mdb;"
myrs.Open "SELECT * FROM [user] where (user.user)='" + mname + "';", mycn, adOpenKeyset, adLockOptimistic
If myrs.BOF = True And myrs.EOF = True Then
MsgBox "查无此人", , "登陆信息"
Else
If myrs("pass") = pass Then
''''''''''''''''''''''''''''''''''''''''''
FrmMain.Show
Unload Me
'''''''''''''''''''''''''''''''''''''''''''''''''''
Else
MsgBox "密码不正确", , "登陆信息"
End If
End If
End Sub
Private Sub Form_DblClick()
MsgBox "hello"
End Sub
Private Sub Form_Load()
Dim mname As String
Dim pass As String
End Sub
mname 和pass 定义在Form_Load()方法中,作用域只在方法内。
而备携搜在Private Sub Command1_Click()里调隐岩用这两个变量,超出了变量的作用域。
你应该把变量定义仿历在窗体级。
nan
