Results 1 to 2 of 2

Thread: Passing objects in Add method for Collection object from ASP page.

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    2

    Passing objects in Add method for Collection object from ASP page.

    To begin, I apologize if this is a silly and trivial question, but it is driving me nuts.

    I have a business object in VB6 called ResultItem that will contain properties for items returned in a search. Sample properties include ItemID (str), Description (str), Price (str).

    I also have a collection object called Results that is a collection of ResultItems. I customized the Add method to be a subroutine and the parameters are objNewMember as ResultItem and Optional sKey as string = "".

    This all, of course, works beautifully in a VB6 exe. But when I try to add a ResultItem to my Results collection via ASP I get a type mismatch error.

    In my ASP script, I create a ResultItem object and load it up fine. Then I create my Results collection object and try to add the ResultItem object to the collection. This is when my type mismatch error occurs.

    I am sure the issue is because we go from ASP, a typeless environment, to COM, a strongly typed environment. But I am sure there is a way to do this.

    I already tried changing my Add method from:
    Public Sub Add(objNewMember as ResultItem, Optional sKey as string = "")
    To:
    Public Sub Add(objNewMember as Variant, Optional sKey as string = "")

    But I get the same thing; type mismatch.

    I also tried this:
    Public Sub Add(sItemID as string, sDescription as string, Optional sKey as string = "")
    and created the ResultItem in my Add method. Now this worked, but the problem with this is I will have many properties in my ResultItem object, and I dont really want to have an Add method with 20 required parameters.

    I would really appreciate any help on how to pass objects in COM methods from an ASP environment.

    Thanks,
    Chris

  2. #2

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    2

    Re: Passing objects in Add method for Collection object from ASP page.

    Well, I figured this out. I guess I did not unregister my older version of the COM or something, because I was able to pass in the ResultItem object as a variant after all.

    Sorry for the question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width