Private Sub Form_Load()
Dim mname As String ‘ 定义变量 用于存放姓名变量
Dim pass As String ‘ 定义变量 用于存放存放变量
End Sub www.751com.cn
Private Sub Command1_Click()
mname = Text1.Text ‘将界面的文本框的值赋给给姓名和密码变量
pass = Text2.Text
Dim mycn As New ADODB.Connection 定义ADO连接
Dim myrs As New ADODB.Recordset 定义ADO记录集
Set myrs = New ADODB.Recordset
mycn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=mang.mdb;"
打开当前目录下的mang.mdb数据库
myrs.Open "SELECT * FROM [user] where (user.user)='" + mname + "';", mycn, adOpenKeyset, adLockOptimistic
通过SQL 语句打开符合姓名变量记录
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 SubPrivate Sub Form_DblClick()
MsgBox "hello"
End Sub
主界面
Private Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" (ByVal lpFileName As String) As Long
'声明API函数用于数据备份和恢复
Private Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long
Private Sub Form_Load()
Me.Left = GetSetting(App.Title, "Settings", "MainLeft", 4000)
Me.Top = GetSetting(App.Title, "Settings", "MainTop", 4000)
Me.Width = GetSetting(App.Title, "Settings", "MainWidth", 6500)
Me.Height = GetSetting(App.Title, "Settings", "MainHeight", 6500)
'定位界面
End SubPrivate Sub mnudayindangan_Click()
Form5.Show '打开界面
End Sub
Private Sub mnudayinlaozi_Click()
DataReport5.Show '打开报表
End Sub
<< 上一页 [11] [12] [13] [14] [15] [16] [17] [18] [19] [20]