Results 1 to 3 of 3

Thread: Recordsets returned from VB dll to ASP

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 1999
    Location
    Belfast
    Posts
    254

    Arrow

    Hello,
    I am having some trouble assigning a recordset returned from a VB dll to as recordset object in ASP. The code below reutrns a type mismatch error:


    Microsoft VBScript runtime error '800a000d'

    Type mismatch: 'getitems'

    /shopping_cart/viewBasket.asp, line 14

    Any help would be greatly appreciated.

    Thakns in Advance.

    Lenin

    <%
    ' Variables
    dim cartid
    dim records
    dim cart1
    set cart1 = server.createObject("shopcart.cart1")
    cart1.createconnection
    cartid = request.cookies("cartid")
    'response.write cartid
    Set records = Server.CreateObject("ADODB.Recordset")
    Set records = cart1.getitems(cartid)

    response.write records.recordcount
    %>


    The function ib VB is:


    Public Function getItems(lCartID As Long) As ADODB.Recordset

    Dim ls_queryString As String
    Dim lrs_getRecords As New ADODB.Recordset

    '
    ' Connect
    '
    createConnection

    ls_queryString = "select widget.widget_id, short_name, price, quantity, price * quantity as Total from cartitem, widget where cart_id = " & lCartID & " and widget.widget_id = cartitem.widget_id"

    lrs_getRecords.ActiveConnection = lconn

    lrs_getRecords.CursorLocation = adUseClient ' Client Side Cursors
    lrs_getRecords.Open ls_queryString, lconn, adOpenStatic, adLockReadOnly

    ' If lrs_getRecords.RecordCount = 0 Then
    ' Exit Function
    ' End If
    '
    ' lrs_getRecords.MoveFirst
    '
    ' Do Until lrs_getRecords.EOF
    ' MsgBox lrs_getRecords!short_name & " " & lrs_getRecords!total
    ' lrs_getRecords.MoveNext
    ' Loop

    Set getItems = lrs_getRecords


    End Function

  2. #2
    Member
    Join Date
    Jan 1999
    Location
    Vancouver, BC, Canada
    Posts
    32
    Asterisk is right. VBScript's variables are of type Variant, so when passing a variable from ASP with VBScript to a VB DLL, make sure your DLL input parameters are Variants as well. The return types from the DLL don't matter, just the input variables must be Variants.

  3. #3
    Lively Member
    Join Date
    Aug 1999
    Posts
    89
    Or you can convert the input param to integer by using cint.e.g.
    cint(request.cookies("cookie"))

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