京东在北京有几个仓库:VB 登陆系统 类型不匹配 怎么办啊!!

来源:百度文库 编辑:神马品牌网 时间:2024/05/05 17:08:14
Private Sub cmdOK_Click()
If text1.Text = "" Then
MsgBox "请填写用户名!", vbInformation + vbOKOnly, "警告"
text1.SetFocus
Exit Sub
End If

If text2.Text = "" Then
MsgBox "请填写密码!", vbInformation + vbOKOnly, "警告"
text2.SetFocus
Exit Sub
End If
g_strsql = "select * from uname where 用户名= '" & text1.Text & "' and 密码= '" & text2.Text & "'"
Set g_rs = g_db.OpenRecordset(g_strsql)

If Not g_rs.EOF Then
text1.Text = g_rs!用户名
text2.Text = g_rs!密码

If g_rs!管理员 = True Then
MsgBox "用户:" + text1.Text + "你当前的身份是管理员,登陆时间:" + MDIForm1.StatusBar1.Panels(4).Text + "", vbInformation + vbOKOnly, "登陆信息"

MDIForm1.StatusBar1.Panels(3).Text = "当前操作员:" & text1.Text & " 登陆身份:管理员"
End If
If g_rs!系统管理员 = True Then
MsgBox "用户:" + text1.Text + "你当前的身份系统管理员,登陆时间:" + MDIForm1.StatusBar1.Panels(4).Text + "", vbInformation + vbOKOnly, "登陆信息"

MDIForm1.StatusBar1.Panels(3).Text = "当前操作员:" & text1.Text & " 登陆身份:系统管理员"
End If
text1.Text = ""
text2.Text = ""
Me.Hide
Else
MsgBox "对不起,你输入的用户和密码不正确,请重新输入!", vbInformation + vbOKOnly, "警告"
text1.Text = ""
text2.Text = ""
text1.SetFocus
End If
Set g_rs = Nothing

End Sub
Option Explicit

Public g_ws As Workspace
Public g_db As Database
Public g_rs As Recordset
Public g_strsql As String
Public readerid As String
Public readeridR As String

Public Sub dbl()
Set g_ws = DBEngine.Workspaces(0)
Set g_db = g_ws.OpenDatabase(App.Path + "\database.mdb", False, False, ";pwd=hdgroup")
End Sub
谢谢!
Private Sub Form_Load()
dbl

End Sub
我已经加了阿!!

因为你把数据库的连接放在dbl函数里
在调用时并没有执行dbl函数:
在这句
Set g_rs = g_db.OpenRecordset(g_strsql)
前面加入
dbl()