高手帮我看看这个VB程序出了什么问题??

来源:百度知道 编辑:UC知道 时间:2024/09/22 03:42:28
Public n As Integer
Dim txtSQL As String

Private Sub Form_Load()
n = 0 'n保存登录的次数
End Sub
Private Sub cmdOK_Click()
Dim mrc As ADODB.Recordset
txtSQL = "select * from oper where 用户名='" & Trim$(txtName.Text) & "' And 密码 = '" & Trim$(txtKey.Text) + "'"
Set mrc = exesql(txtSQL)
If mrc.RecordCount = 0 Then '未找到用户记录
n = n + 1
If n < 10 Then
MsgBox "没有这个用户,继续登录", vbOKOnly + vbExclamation, "信息提示"
txtName.Text = ""
txtKey.Text = ""
txtName.SetFocus
Else
MsgBox "已登录失败十次,退出系统", vbOKOnly + vbExclamation, "信息提示"
mrc.Close
Unload Me
End If
Else
userlevel = Trim(mrc.Fields("级别"))
mrc.Close
Unload Me
Menu.Show '调用窗体
End If

在工具-引用里面,看你是否引用了microsoft activeX data object 2.8 library,没有的话在前面加上x然后再运行,如果不行就把microsoft ADO Ext 2.8 for DDL and Security也加上x,应该就可以了,是你的EXCEL没有引用microsoft的工程

有sql数据库吗

看msvbvm60.dll是否存在。