Results 1 to 4 of 4

Thread: Using ByRef Parameters in MTS objects

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    10

    Cool

    Hi,

    I've built an ASP page which uses an activeX DLL to retrieve data from a database.

    The function which retrieves the data (in side the DLL) loocs like :

    Public function GetRS(ByVal ID as integer, Optional ByRef Hresult as Variant) as ADODB.Recordset

    The function builds a recordset and uses the Hresult variant to return Error Codes.

    I developed that DLL as a normal DLL, It worked grate the recordset was created and the Hresult returned Errors as planed, so I happily moved to the 2nd stage which was to place the DLL in a MTS.

    When I placed the DLL in the MTS Hresult stopped working. My ASP received the recordset correctly but did not get the Hresult values (Hresult is always empty).

    Way Is that ?

    Thanks

    Erez
    Erez Boym
    Email : [email protected]

  2. #2
    Addicted Member
    Join Date
    Jun 1999
    Location
    Los Angeles
    Posts
    186
    Hi there,

    This is an extract of an article on best practices for building VB COM objects to be used with ASP:

    http://support.microsoft.com/support.../Q243/5/48.ASP

    ByRef parameters should be passed as Variant while ByVal parameters can be specific data types. For additional information.

    Search for:Passing Parameters By Reference to a VB COM Object


    Do not register your component with MTS unless you need transactions. ObjectContext can be expensive in terms of performance.


    cheers,
    André

  3. #3
    Addicted Member
    Join Date
    Jun 1999
    Location
    Los Angeles
    Posts
    186
    Hmmmm, Hi again, I see from your code line that it is a function. The function will only return a recordset, no Hresult!, if you want to put a value in Hresult, maybe you need a Public Sub GetRS(ByVal ID as integer, Optional ByRef Hresult as Variant, RS as ADODB.Recordset )

    André

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    10

    Cool Using ByRef Parameters in MTS objects - Conclusion

    Hi,

    Ok, At last it works and there are our conclusions from our ordeal with IIs and MTS :

    1) Use ADO 2.1 and to ADO 2.0

    2) Use "CreateObject" insted of <OBJECT>

    3) dont use function AI public function <name>(<input params>) as <return val>
    Create all your objects in the IIS and send them "By Ref" to the MTS
    object. AI public sub <name>(<input Parameters>, <Output Parameters>)

    Have fun

    Erez
    Erez Boym
    Email : [email protected]

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