我编写一个登录的小程序,点Command1(确定)按钮
Private Sub Command1_Click()
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim strsql As String
Set cnn = New ADODB.Connection
Set rst = New ADODB.Recordset
cnn.Open Connstring
strsql = "select * from 1 where a='" & Text1.Text & "'"
rst.Open strsql, cnn, adOpenStatic, adLockReadOnly
If rst.EOF = True And rst.BOF = True Then
MsgBox "用户名或密码错误!", 48 + vbOKOnly, "提示信息"
Else
Set rst = Nothing
Set cnn = Nothing
MsgBox "登录成功!", 48 + vbOKOnly, "提示信息"
Exit Sub
运行时出现以下的错误:
编译错误:用户定义类型未定义
请问怎么解决???
Private Sub Command1_Click()
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim strsql As String
Set cnn = New ADODB.Connection
Set rst = New ADODB.Recordset
cnn.Open Connstring
strsql = "select * from 1 where a='" & Text1.Text & "'"
rst.Open strsql, cnn, adOpenStatic, adLockReadOnly
If rst.EOF = True And rst.BOF = True Then
MsgBox "用户名或密码错误!", 48 + vbOKOnly, "提示信息"
Else
Set rst = Nothing
Set cnn = Nothing
MsgBox "登录成功!", 48 + vbOKOnly, "提示信息"
Exit Sub
运行时出现以下的错误:
编译错误:用户定义类型未定义
请问怎么解决???
Microsoft ADO Data Control 6.0
Microsoft ActiveX Data controls 2.x
添加ado的引用
我也说!
引用ADO~~~