vb引用dll出现错误
vb代码:et ConDB = CreateObject("krmc.dll")
Set conn = ConDB.ConnectDB(code, mima)
dll代码:Public Function ConnectDB(ByVal zhanghao As Variant, ByVal mima As Variant) As Variant
Dim Conn 'As New ADODB.Connection
'Dim rs As New ADODB.Recordset
Dim ConDB
Dim StrConn
StrConn = "Provider=SQLoledb;data source=YAO;UID=;PWD=;Initial Catalog=rainbow;Integrated Security=SSPI;data source=127.0.0.1"
Set Conn = CreateObject("ADODB.Connection")
Conn.Open StrConn
If Err Then
Err.Clear
Set Conn = Nothing
MsgBox "连接失败!", 64, "提示"
End If
Set rs = CreateObject("ADODB.Recordset")
rs.Open "SELECT * FROM Userinfo WHERE code='" & zhanghao & "' and password='" & mima & "'", Conn, 1, 3
If rs.EOF Then
ConnectDB = rs("username")
Else
MsgBox "帐号或密码错误!", 64, "提示"
End If
End Function
错误为:
运行时错误429''
ActiveX部件不能创建对象