Dim userDB As Database
Dim userRD As Recordset
Dim dbName As String
Dim STRSQL As String
Screen.MousePointer = 11
On Error GoTo errEnd
dbName = App.Path
If Right(dbName, 1) <> "、" Then dbName = dbName + "、"
dbName = dbName + "DataBase、WFSSDataBase.mdb"
STRSQL = "select [用户身份] from [Admin] where [用户ID]=""" & userID & """ and [用户密码]=""" & passwd & """"
'打开数据库
Set userDB = DBEngine.Workspaces(0).OpenDatabase(dbName, False, True)
'检索用户,验证密码
Set userRD = userDB.OpenRecordset(STRSQL, dbOpenSnapshot)
If userRD.RecordCount > 0 Then
'设置用户身份
UserShenFen = userRD![用户身份]
'关闭数据库
userRD.Close
Set userRD = Nothing
userDB.Close
Set userDB = Nothing
'进入用户环境
Load FrmMain
FrmMain.Show
Unload FrmLogIn
logOK = True
userName = userID
Screen.MousePointer = vbDefault
Else
'关闭数据库
userRD.Close
Set userRD = Nothing
userDB.Close
Set userDB = Nothing
logOK = False
Screen.MousePointer = vbDefault
MsgBox "用户名或密码错误!请重新输入!", vbOKOnly + vbExclamation, "登陆失败"
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>