vb引用dll出现问题
vb代码如下:sr为定义的server
Set ConDB = sr.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
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 = Server.CreateObject("ADODB.CONNECTION")
Conn.Open StrConn
If Err Then
Err.Clear
Set Conn = Nothing
MsgBox "连接失败!", 64, "提示"
rp.End
End If
Set rs = Server.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
请教高手