
ActiveX DLL Component testing/Debugging (passing collections in immediate window)
I have an ActiveX DLL component I made for my ASP website. I'm trying
to debug it. I did a Run/Start with full compile. Then clicked on
pause (|| button, called Break). Then went to the immediate window and
typed "set obj = new UserClass" (UserClass is a class module inside my
DLL component that I want to debug). I can then sort of interact with
my methods/etc by doing things like "? obj.property" but since I'm doing
this in
Visual Basic for ASP pages my arguements are all Variants. In
particular collections (so I can pass them back and forth from the
ActiveX DLL to my ASP pages). How do I pass a Collection in my
immediate window?? Below is an example of one of my methods in my
UsersClass class module. So I do run, break, go to immediate window and
type "set obj = new UsersClass" (a class module in my project). Then do
"? obj.UserAuth" (a method/function in UsersClass) and of course I get a
runtime error saying argument not optional, because I didn't pass the
vAuthInfo collection. How do I do that? How do I pass a collection of
variables inside the immediate window? Below is the method... I need to
pass a Collection to it that holds "usersname" and "password" as a
Variant/Collection.
Public Function UserAuth(ByVal vAuthInfo As Variant) As Variant
Dim vResponse As New Collection
Dim SQLString As String
Dim DBConn As String
DBConn = "filedsn=c:\filedsn.dsn;UID=ibbs;PWD=ibbs123;"
SQLString = "SELECT [user].username, [user].password, [user].custnum,
[user].email FROM [user]"
SQLString = SQLString & " WHERE [user].username = '" &
vAuthInfo("username") & "'"
Set oDb = CreateObject("ADODB.Connection")
oDb.Open DBConn
Set oRs = oDb.Execute(SQLString)
If Not oRs.EOF Then ' User exists
vResponse.Add True, Key:="exists"
vResponse.Add Trim(oRs.Fields("username")), "username"
vResponse.Add Trim(oRs.Fields("password")), "password"
vResponse.Add Trim(oRs.Fields("email")), "email"
vResponse.Add Trim(oRs.Fields("custnum")), "custnum"
If (Trim(oRs.Fields("password")) Like Trim(vAuthInfo("password")))
Then ' Correct password
vResponse.Add True, Key:="passed"
Else
vResponse.Add False, Key:="passed"
End If
Else
vResponse.Add False, Key:="exists"
End If
oDb.Close
Set UserAuth = vResponse
End Function
--
Rick Di Lorenzo
Systems Administrator
MCP+Internet MCSE
JCI Corporation